Ueberauth Spotify Strategy v0.2.0 Ueberauth.Strategy.Spotify.OAuth View Source
OAuth2 for Spotify.
Add client_id and client_secret to your configuration:
config :ueberauth, Ueberauth.Strategy.Spotify.OAuth, client_id: System.get_env("SPOTIFY_APP_ID"), client_secret: System.get_env("SPOTIFY_APP_SECRET") TODO SPOTIFY_REDIRECT_URI
Link to this section Summary
Functions
Builds the URL to the authorization endpoint.
Provides the authorize url for the request phase of Ueberauth. No need to call this usually.
Construct a client for requests to Spotify.
Builds the URL to token endpoint.
Link to this section Functions
authorize_url(client, params) View Source
Builds the URL to the authorization endpoint.
Example
def authorize_url(client, params) do
client
|> put_param(:response_type, "code")
|> put_param(:client_id, client.client_id)
|> put_param(:redirect_uri, client.redirect_uri)
|> merge_params(params)
end
Callback implementation for OAuth2.Strategy.authorize_url/2.
authorize_url!(params \\ [], opts \\ []) View Source
Provides the authorize url for the request phase of Ueberauth. No need to call this usually.
client(opts \\ []) View Source
Construct a client for requests to Spotify.
This will be setup automatically for you in Ueberauth.Strategy.Spotify.
These options are only useful for usage outside the normal callback phase of Ueberauth.
encode_credentials(client_id, client_secret) View Source
get(token, url, headers \\ [], opts \\ []) View Source
get_token(client, params, headers) View Source
Builds the URL to token endpoint.
Example
def get_token(client, params, headers) do
client
|> put_param(:code, params[:code])
|> put_param(:grant_type, "authorization_code")
|> put_param(:client_id, client.client_id)
|> put_param(:client_secret, client.client_secret)
|> put_param(:redirect_uri, client.redirect_uri)
|> merge_params(params)
|> put_headers(headers)
end
Callback implementation for OAuth2.Strategy.get_token/3.
get_token!(params \\ [], options \\ [])
View Source
get_token!(term(), keyword()) :: OAuth2.AccessToken.t()
get_token!(term(), keyword()) :: OAuth2.AccessToken.t()