Class: Oauthio::Strategy::AuthCode
- Inherits:
-
OAuth2::Strategy::AuthCode
- Object
- OAuth2::Strategy::AuthCode
- Oauthio::Strategy::AuthCode
- Defined in:
- lib/oauthio/strategy/auth_code.rb
Instance Method Summary collapse
-
#authorize_params(params = {}) ⇒ Object
The required query parameters for the authorize URL.
-
#authorize_url(provider, params = {}) ⇒ Object
The authorization URL endpoint of the provider.
-
#client_params ⇒ Hash
The OAuth client_id and client_secret.
-
#get_token(code, params = {}, opts = {}) ⇒ Object
Retrieve an access token given the specified validation code.
-
#initialize(client) ⇒ AuthCode
constructor
A new instance of AuthCode.
Constructor Details
#initialize(client) ⇒ AuthCode
Returns a new instance of AuthCode.
4 5 6 |
# File 'lib/oauthio/strategy/auth_code.rb', line 4 def initialize(client) @client = client end |
Instance Method Details
#authorize_params(params = {}) ⇒ Object
The required query parameters for the authorize URL
18 19 20 |
# File 'lib/oauthio/strategy/auth_code.rb', line 18 def (params={}) params.merge('k' => @client.id) end |
#authorize_url(provider, params = {}) ⇒ Object
The authorization URL endpoint of the provider
11 12 13 |
# File 'lib/oauthio/strategy/auth_code.rb', line 11 def (provider, params = {}) @client.(provider, .merge(params)) end |
#client_params ⇒ Hash
The OAuth client_id and client_secret
25 26 27 |
# File 'lib/oauthio/strategy/auth_code.rb', line 25 def client_params {'key' => @client.id, 'secret' => @client.secret} end |
#get_token(code, params = {}, opts = {}) ⇒ Object
Note:
that you must also provide a :redirect_uri with most OAuth 2.0 providers
Retrieve an access token given the specified validation code.
35 36 37 38 |
# File 'lib/oauthio/strategy/auth_code.rb', line 35 def get_token(code, params = {}, opts = {}) params = {'code' => code}.merge(client_params).merge(params) @client.get_token(params, opts) end |