DocuSign v0.2.1 DocuSign.OAuth View Source
This module implements an oauth2 strategy for DocuSign.
Examples
client = DocuSign.OAuth2Strategy.get_token! {:ok, user_info } = OAuth2.Client.get(client, "/oauth/userinfo")
Link to this section Summary
Functions
Builds the URL to the authorization endpoint.
Create new API client
Builds the URL to token endpoint.
Retrieve access token and return a client
Retrieve a new time to auto refresh token.
Refresh token
Check expiration of token return true if token is expired
Link to this section Types
headers() View Source
param() View Source
params() View Source
Link to this section Functions
assertion() View Source
authorize_url(client, params) View Source
Builds the URL to the authorization endpoint.
Example
def authorize_url(client, params) do
client
|> put_param(:response_type, "code")
|> put_param(:client_id, client.client_id)
|> put_param(:redirect_uri, client.redirect_uri)
|> merge_params(params)
end
Callback implementation for OAuth2.Strategy.authorize_url/2
.
client(opts \\ [])
View Source
client(Keyword.t()) :: OAuth2.Client.t()
client(Keyword.t()) :: OAuth2.Client.t()
Create new API client
get_token(client, params, headers)
View Source
get_token(OAuth2.Client.t(), Keyword.t(), Keyword.t()) :: binary() | no_return()
get_token(OAuth2.Client.t(), Keyword.t(), Keyword.t()) :: binary() | no_return()
Builds the URL to token endpoint.
Example
def get_token(client, params, headers) do
client
|> put_param(:code, params[:code])
|> put_param(:grant_type, "authorization_code")
|> put_param(:client_id, client.client_id)
|> put_param(:client_secret, client.client_secret)
|> put_param(:redirect_uri, client.redirect_uri)
|> merge_params(params)
|> put_headers(headers)
end
Callback implementation for OAuth2.Strategy.get_token/3
.
get_token!(client, params \\ [], headers \\ [], opts \\ [])
View Source
get_token!(OAuth2.Client.t(), params(), headers(), Keyword.t()) ::
OAuth2.Client.t() | OAuth2.Error.t()
get_token!(OAuth2.Client.t(), params(), headers(), Keyword.t()) :: OAuth2.Client.t() | OAuth2.Error.t()
Retrieve access token and return a client
interval_refresh_token(client)
View Source
interval_refresh_token(OAuth2.Client.t()) :: integer()
interval_refresh_token(OAuth2.Client.t()) :: integer()
Retrieve a new time to auto refresh token.
refresh_token!(client, force \\ false)
View Source
refresh_token!(OAuth2.Client.t(), boolean()) :: OAuth2.Client.t()
refresh_token!(OAuth2.Client.t(), boolean()) :: OAuth2.Client.t()
Refresh token
token_expired?(token)
View Source
token_expired?(OAuth2.AccessToken.t() | nil | OAuth2.Client.t()) :: boolean()
token_expired?(OAuth2.AccessToken.t() | nil | OAuth2.Client.t()) :: boolean()
Check expiration of token return true if token is expired