gmail v0.0.10 Gmail.OAuth2

OAuth2 access token handling.

Summary

Functions

Checks if an access token has expired

Gets the config for a Gmail API connection, including a refreshed access token

Refreshes an expired access token

Types

t :: %Gmail.OAuth2{access_token: term, client_id: term, client_secret: term, expires_at: term, refresh_token: term, token_type: term, user_id: term}

Functions

access_token_expired?(o_auth2)

Specs

access_token_expired?(Gmail.OAuth2.t) :: boolean

Checks if an access token has expired.

Examples

iex> Gmail.OAuth2.access_token_expired?(%Gmail.OAuth2{expires_at: 1})
true

iex> Gmail.OAuth2.access_token_expired?(%Gmail.OAuth2{expires_at: (Timex.Date.to_secs(Timex.Date.now) + 10)})
false
get_config()

Specs

get_config :: Gmail.OAuth2.t

Gets the config for a Gmail API connection, including a refreshed access token.

refresh_access_token(opts)

Specs

refresh_access_token(Gmail.OAuth2.t) :: {:ok, Gmail.OAuth2.t}

Refreshes an expired access token.