Class: FbGraph2::Auth
- Inherits:
-
Rack::OAuth2::Client
- Object
- Rack::OAuth2::Client
- FbGraph2::Auth
- Defined in:
- lib/fb_graph2/auth.rb
Defined Under Namespace
Classes: Grant
Instance Method Summary collapse
- #access_token!(options = {}) ⇒ Object
- #fb_exchange_token=(access_token) ⇒ Object
-
#initialize(client_id, client_secret, options = {}) ⇒ Auth
constructor
A new instance of Auth.
Constructor Details
#initialize(client_id, client_secret, options = {}) ⇒ Auth
Returns a new instance of Auth.
9 10 11 12 13 14 15 16 17 |
# File 'lib/fb_graph2/auth.rb', line 9 def initialize(client_id, client_secret, = {}) super .merge( identifier: client_id, secret: client_secret, host: URI.parse(FbGraph2.root_url).host, authorization_endpoint: '/oauth/authorize', token_endpoint: '/oauth/access_token' ) end |
Instance Method Details
#access_token!(options = {}) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/fb_graph2/auth.rb', line 25 def access_token!( = {}) super .merge( client_auth_method: :body ) rescue Rack::OAuth2::Client::Error => e raise Exception.detect(e.status, e.response) end |
#fb_exchange_token=(access_token) ⇒ Object
19 20 21 22 23 |
# File 'lib/fb_graph2/auth.rb', line 19 def fb_exchange_token=(access_token) @grant = Grant::FbExchangeToken.new( fb_exchange_token: access_token ) end |