Class: OmniAuth::Strategies::OAuth2
- Inherits:
-
Object
- Object
- OmniAuth::Strategies::OAuth2
- Includes:
- OmniAuth::Strategy
- Defined in:
- lib/omniauth/strategies/oauth2.rb
Overview
Authentication strategy for connecting with APIs constructed using the OAuth 2.0 Specification. You must generally register your application with the provider and utilize an application id and secret in order to authenticate using OAuth 2.0.
Direct Known Subclasses
AngelList, Bitly, Cobot, Dailymile, Doit, Facebook, Foursquare, GitHub, Glitch, GoogleOAuth2, Gowalla, Instagram, Liveid, Mailchimp, Mailru, Mixi, Renren, Salesforce, SoundCloud, Taobao, Teambox, ThirtySevenSignals, Viadeo, Vkontakte, WePay, Yammer
Defined Under Namespace
Classes: CallbackError
Instance Attribute Summary collapse
-
#client_id ⇒ Object
The
OAuth2::Client
for this strategy. -
#client_options ⇒ Object
The
OAuth2::Client
for this strategy. -
#client_secret ⇒ Object
The
OAuth2::Client
for this strategy. -
#options ⇒ Object
The options passed in to the strategy.
Instance Method Summary collapse
- #callback_url ⇒ Object
- #client ⇒ Object
-
#initialize(app, name, client_id = nil, client_secret = nil, client_options = {}, options = {}, &block) ⇒ OAuth2
constructor
A new instance of OAuth2.
Constructor Details
#initialize(app, name, client_id = nil, client_secret = nil, client_options = {}, options = {}, &block) ⇒ OAuth2
Returns a new instance of OAuth2.
40 41 42 43 44 45 |
# File 'lib/omniauth/strategies/oauth2.rb', line 40 def initialize(app, name, client_id=nil, client_secret=nil, ={}, ={}, &block) self.client_id = client_id self.client_secret = client_secret self. = super end |
Instance Attribute Details
#client_id ⇒ Object
The OAuth2::Client
for this strategy.
19 20 21 |
# File 'lib/omniauth/strategies/oauth2.rb', line 19 def client_id @client_id end |
#client_options ⇒ Object
The OAuth2::Client
for this strategy.
19 20 21 |
# File 'lib/omniauth/strategies/oauth2.rb', line 19 def @client_options end |
#client_secret ⇒ Object
The OAuth2::Client
for this strategy.
19 20 21 |
# File 'lib/omniauth/strategies/oauth2.rb', line 19 def client_secret @client_secret end |
#options ⇒ Object
The options passed in to the strategy.
17 18 19 |
# File 'lib/omniauth/strategies/oauth2.rb', line 17 def @options end |
Instance Method Details
#callback_url ⇒ Object
51 52 53 |
# File 'lib/omniauth/strategies/oauth2.rb', line 51 def callback_url full_host + script_name + callback_path end |
#client ⇒ Object
47 48 49 |
# File 'lib/omniauth/strategies/oauth2.rb', line 47 def client ::OAuth2::Client.new(client_id, client_secret, .merge([:client_options] || {})) end |