Class: OAuth2::Strategy::AuthCode
- Inherits:
-
Base
- Object
- Base
- OAuth2::Strategy::AuthCode
- Defined in:
- lib/oauth2/strategy/auth_code.rb
Overview
The Authorization Code Strategy
Instance Method Summary (collapse)
-
- (Object) authorize_params(params = {})
The required query parameters for the authorize URL.
-
- (Object) authorize_url(params = {})
The authorization URL endpoint of the provider.
-
- (Object) get_token(code, params = {})
Retrieve an access token given the specified validation code.
Methods inherited from Base
Constructor Details
This class inherits a constructor from OAuth2::Strategy::Base
Instance Method Details
- (Object) authorize_params(params = {})
The required query parameters for the authorize URL
12 13 14 |
# File 'lib/oauth2/strategy/auth_code.rb', line 12 def (params={}) super(params).merge('response_type' => 'code') end |
- (Object) authorize_url(params = {})
The authorization URL endpoint of the provider
19 20 21 |
# File 'lib/oauth2/strategy/auth_code.rb', line 19 def (params={}) @client.(.merge(params)) end |
- (Object) get_token(code, params = {})
Note:
that you must also provide a :redirect_uri with most OAuth 2.0 providers
Retrieve an access token given the specified validation code.
28 29 30 31 |
# File 'lib/oauth2/strategy/auth_code.rb', line 28 def get_token(code, params={}) params = { 'grant_type' => 'authorization_code', 'code' => code }.merge(client_params).merge(params) OAuth2::AccessToken.from_token_params(@client, params) end |