Class: OmniAuth::Strategies::Bitly
- Defined in:
- lib/omniauth/strategies/oauth2/bitly.rb
Overview
Authenticate to Bitly utilizing OAuth 2.0 and retrieve basic user information.
Instance Attribute Summary
Attributes inherited from OAuth2
#client_id, #client_options, #client_secret, #options
Instance Method Summary collapse
- #auth_hash ⇒ Object
-
#initialize(app, client_id = nil, client_secret = nil, options = {}, &block) ⇒ Bitly
constructor
A new instance of Bitly.
- #user_data ⇒ Object
Methods inherited from OAuth2
Constructor Details
#initialize(app, client_id = nil, client_secret = nil, options = {}, &block) ⇒ Bitly
Returns a new instance of Bitly.
15 16 17 18 19 20 21 |
# File 'lib/omniauth/strategies/oauth2/bitly.rb', line 15 def initialize(app, client_id=nil, client_secret=nil, ={}, &block) = { :authorize_url => 'https://bit.ly/oauth/authorize', :token_url => 'https://api-ssl.bit.ly/oauth/access_token', } super(app, :bitly, client_id, client_secret, , , &block) end |
Instance Method Details
#auth_hash ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/omniauth/strategies/oauth2/bitly.rb', line 23 def auth_hash OmniAuth::Utils.deep_merge( super, { 'uid' => @access_token['login'], 'user_info' => user_data, 'extra' => { 'user_hash' => user_data, }, } ) end |
#user_data ⇒ Object
35 36 37 38 39 40 |
# File 'lib/omniauth/strategies/oauth2/bitly.rb', line 35 def user_data { 'login' => @access_token['login'], 'client_id' => @access_token['apiKey'], } end |