View Source TwitchEx.OAuth (TwitchEx v0.1.0)

Custom Twitch OAuth2/Client Credentials Grant Flow solution.

twitch-documentation

Twitch Documentation:

https://dev.twitch.tv/docs/authentication/getting-tokens-oauth/

Link to this section Summary

Functions

Generates an authorization URL that the user visits to grant your app certain scopes. You must implement the callback at redirect_uri that collects the returned code and retrieves the actual oauth token.

Gets an application access token for the given client's ID and secret via the Client Credentials Flow. Returns the decoded post body.

Generates an authorization URL that simply redirects to twitch.tv. You should only use this function when you don't need the auth code to complete the Authorization Code Grant Flow. Otherwise, you should use authorization_url/4.

Link to this section Functions

Link to this function

authorization_url(state, client_id, redirect_uri, scopes)

View Source

Generates an authorization URL that the user visits to grant your app certain scopes. You must implement the callback at redirect_uri that collects the returned code and retrieves the actual oauth token.

Link to this function

get_app_access_token(client_id, client_secret)

View Source

Gets an application access token for the given client's ID and secret via the Client Credentials Flow. Returns the decoded post body.

Example return value:

%{
  "access_token" => "some token here",
  "expires_in" => 5011271,
  "token_type" => "bearer"
}

Twitch Client Credentials Flow documentation

https://dev.twitch.tv/docs/authentication/getting-tokens-oauth/#client-credentials-grant-flow

Link to this function

simple_authorize_url(client_id, scopes)

View Source

Generates an authorization URL that simply redirects to twitch.tv. You should only use this function when you don't need the auth code to complete the Authorization Code Grant Flow. Otherwise, you should use authorization_url/4.