Class: InstagramConnect::Auth::Strategy

Inherits:
Object
  • Object
show all
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

FacebookLogin, InstagramLogin

Constant Summary collapse

HTTP_TIMEOUT =
30

Instance Method Summary collapse

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.

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/instagram_connect/auth/strategy.rb', line 29

def authorize_url(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) }

Raises:

  • (NotImplementedError)


35
36
37
# File 'lib/instagram_connect/auth/strategy.rb', line 35

def exchange_code(code:, redirect_uri:)
  raise NotImplementedError
end

#graph_hostObject

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/instagram_connect/auth/strategy.rb', line 41

def refresh_token(access_token:)
  raise NotImplementedError
end

#scopesObject

The scope set requested during OAuth.

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/instagram_connect/auth/strategy.rb', line 24

def scopes
  raise NotImplementedError
end