10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/warden/oauth2/error_app.rb', line 10
def call(env)
warden = env['warden']
strategy = warden.winning_strategy
status = strategy.respond_to?(:error_status) ? strategy.error_status : 401
error_description = strategy.respond_to?(:error_description) ? strategy.error_description : ''
= {'Content-Type' => 'application/json'}
['X-Accepted-OAuth-Scopes'] = (strategy.scope || :public).to_s
body = %Q{"error":"#{strategy.message}", "error_description":"#{error_description}"}
Rack::Response.new(body, status, ).finish
end
|