Class: Grape::OAuth2::Generators::Authorization
- Defined in:
- lib/grape_oauth2/generators/authorization.rb
Overview
OAuth2 Authorization generator class. Processes the request and builds the response.
Class Method Summary collapse
-
.generate_for(env, &_block) ⇒ Grape::OAuth2::Responses::Authorization
Generates Authorization Response based on the request.
Methods inherited from Base
Class Method Details
.generate_for(env, &_block) ⇒ Grape::OAuth2::Responses::Authorization
Generates Authorization Response based on the request.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/grape_oauth2/generators/authorization.rb', line 12 def generate_for(env, &_block) = Rack::OAuth2::Server::Authorize.new do |request, response| if block_given? yield request, response else execute_default(request, response) end end Grape::OAuth2::Responses::Authorization.new(.call(env)) rescue Rack::OAuth2::Server::Authorize::BadRequest => error error_response(error) end |