View Source Squeeze.Fitbit.AuthBehaviour behaviour (OpenPace v0.0.1)
Behaviour module defining callbacks for Fitbit OAuth authentication.
Link to this section Summary
Callbacks
Generates the authorization URL for the OAuth2 flow.
Creates credential map from OAuth2 client response.
Gets an OAuth2 token, returns {:ok, client} or {:error, reason}.
Gets an OAuth2 token, raising an error if the request fails.
Creates a new OAuth2 client with default configuration.
Link to this section Types
@type client() :: OAuth2.Client.t()
@type code() :: String.t()
@type grant_type() :: String.t()
@type scope() :: String.t()
@type token() :: OAuth2.AccessToken.t()
@type token_opts() :: [ code: code(), grant_type: grant_type(), refresh_token: binary() ]
Link to this section Callbacks
@callback authorize_url!() :: String.t()
Generates the authorization URL for the OAuth2 flow.
@callback get_credential!(client()) :: credential()
Creates credential map from OAuth2 client response.
Gets an OAuth2 token, returns {:ok, client} or {:error, reason}.
@callback get_token(token_opts()) :: {:ok, client()} | {:error, any()}
@callback get_token(token_opts(), headers()) :: {:ok, client()} | {:error, any()}
@callback get_token!() :: client()
Gets an OAuth2 token, raising an error if the request fails.
@callback get_token!(token_opts()) :: client()
@callback get_token!(token_opts(), headers()) :: client()
@callback new() :: client()
Creates a new OAuth2 client with default configuration.