Class: OAuth2::AuthResponse
- Inherits:
-
Object
- Object
- OAuth2::AuthResponse
- Defined in:
- lib/oauth20/auth_response.rb
Overview
Authorization code response. It contains all the important data to build response with new authorization code.
Instance Method Summary collapse
-
#initialize(request) ⇒ AuthResponse
constructor
Initialize new authorization response.
-
#to_url ⇒ Object
Get the redirect URI based on response attributes.
Constructor Details
#initialize(request) ⇒ AuthResponse
Initialize new authorization response.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/oauth20/auth_response.rb', line 11 def initialize(request) @scope = request.scope @state = request.state @redirect_uri = request.redirect_uri @code = OAuth2::AuthCode.new({ :user_id => request.user.email, :client_key => request.client.key, :key => OAuth2::Utils.generate_key }) @code.save end |
Instance Method Details
#to_url ⇒ Object
Get the redirect URI based on response attributes.
27 28 29 |
# File 'lib/oauth20/auth_response.rb', line 27 def to_url "#{@redirect_uri}?code=#{@code.key}&state=#{@state}&scope=#{@scope}" end |