Exyt v0.2.0 Exyt.Auth View Source
A struct to fetch access / refresh token(s) from the Google’s OAuth2 endpoints.
Link to this section Summary
Functions
Fetches the access / refresh token
Fetches the access / refresh token
Refreshes the (expired) access token, by using the refresh token
Refreshes the (expired) access token, by using the refresh token. See Auth.refresh_token/1
for details
Link to this section Functions
access_token(Exyt.Client.t(), binary()) :: {:ok, Exyt.AccessToken.t()} | {:error, binary()}
Fetches the access / refresh token
Parameters
client
- The Client struct to fetch access token withcode
- The authorization code fetched from OAuth2 callback
Returns a tuple with access token or an error message
access_token!(Exyt.Client.t(), binary()) :: Exyt.AccessToken.t()
Fetches the access / refresh token
Parameters
client
- The client struct to fetch access token withcode
- The authorization code fetched from OAuth2 callback
Returns a %Exyt.AccessToken
with a token or raises an Exyt.Auth.HTTPError
with a message.
refresh_token(Exyt.Client.t()) :: {:ok, Exyt.AccessToken.t()} | {:error, binary()}
Refreshes the (expired) access token, by using the refresh token.
Getting a new access token only works when the request of Auth.access_token
inlcudes the
grant_type=offline
query parameter. This is in order to allow refreshing an expired access token.
For more details see Refreshing an Access Token.
Parameters
client
- The client struct that contains the access token.
refresh_token!(Exyt.Client.t()) :: Exyt.AccessToken.t()
Refreshes the (expired) access token, by using the refresh token. See Auth.refresh_token/1
for details.
Returns a %Exyt.AccessToken
with a new token or raises an Exyt.Auth.HTTPError
with a message.