OAuth2.AccessToken
Provides functionality to make authorized requests to an OAuth2 provider.
Summary↑
expired?(token) | Determines if the access token has expired |
expires?(accesstoken) | Determines if the access token expires or not |
expires_at(val) | Returns a unix timestamp based on now + expires_at (in seconds) |
get!(token, url, headers \\ [], opts \\ []) | Makes a |
get(token, url, headers \\ [], opts \\ []) | Makes a |
new(token, client) | Returns a new AccessToken struct |
Types ↑
access_token :: binary
refresh_token :: binary
expires_at :: integer
token_type :: binary
other_params :: %{}
t :: %OAuth2.AccessToken{access_token: access_token, refresh_token: refresh_token, expires_at: expires_at, token_type: token_type, other_params: other_params, client: OAuth2.Client.t}
Functions
Determines if the access token has expired.
Determines if the access token expires or not.
Returns true
unless expires_at
is nil
.
Returns a unix timestamp based on now + expires_at (in seconds).
Makes a GET
request to the given URL using the AccessToken.
Makes a GET
request to the given URL using the AccessToken.
An OAuth2.Error
exception is raised if the request results in an
error tuple ({:error, reason}
).
Specs:
- new(Dict.t | String.t, OAuth2.Client.t) :: t
Returns a new AccessToken struct.