Class: InstagramConnect::Auth::Strategy
- Inherits:
-
Object
- Object
- InstagramConnect::Auth::Strategy
- Defined in:
- lib/instagram_connect/auth/strategy.rb
Overview
Common interface for a Meta login path. Concrete strategies differ only in the Graph host, the OAuth dialog/exchange endpoints, and the scope set. Subclasses implement the public methods; the shared token-lifetime helper and credential accessors live here.
Direct Known Subclasses
Constant Summary collapse
- HTTP_TIMEOUT =
30
Instance Method Summary collapse
-
#authorize_url(redirect_uri:, state:) ⇒ Object
The "log in with…" dialog URL the host redirects the operator to.
-
#exchange_code(code:, redirect_uri:) ⇒ Object
Exchange an authorization code for a long-lived token.
-
#graph_host ⇒ Object
e.g.
-
#initialize(config) ⇒ Strategy
constructor
A new instance of Strategy.
-
#refresh_token(access_token:) ⇒ Object
Refresh a long-lived token.
-
#scopes ⇒ Object
The scope set requested during OAuth.
Constructor Details
#initialize(config) ⇒ Strategy
Returns a new instance of Strategy.
14 15 16 |
# File 'lib/instagram_connect/auth/strategy.rb', line 14 def initialize(config) @config = config end |
Instance Method Details
#authorize_url(redirect_uri:, state:) ⇒ Object
The "log in with…" dialog URL the host redirects the operator to.
29 30 31 |
# File 'lib/instagram_connect/auth/strategy.rb', line 29 def (redirect_uri:, state:) raise NotImplementedError end |
#exchange_code(code:, redirect_uri:) ⇒ Object
Exchange an authorization code for a long-lived token. Returns a hash:
{ access_token:, expires_at:, ig_user_id: (optional), page_id: (optional) }
35 36 37 |
# File 'lib/instagram_connect/auth/strategy.rb', line 35 def exchange_code(code:, redirect_uri:) raise NotImplementedError end |
#graph_host ⇒ Object
19 20 21 |
# File 'lib/instagram_connect/auth/strategy.rb', line 19 def graph_host raise NotImplementedError end |
#refresh_token(access_token:) ⇒ Object
Refresh a long-lived token. Returns { access_token:, expires_at: }. Paths whose tokens don't expire return the token unchanged.
41 42 43 |
# File 'lib/instagram_connect/auth/strategy.rb', line 41 def refresh_token(access_token:) raise NotImplementedError end |
#scopes ⇒ Object
The scope set requested during OAuth.
24 25 26 |
# File 'lib/instagram_connect/auth/strategy.rb', line 24 def scopes raise NotImplementedError end |