Dnsimple.Oauth (dnsimple v3.1.0) View Source

Provides functions to authenticate through the OAuth web application flow.

See:

Link to this section Summary

Functions

Returns the URL to start the OAuth dance.

Returns the access token for a given authorization code.

Link to this section Functions

Link to this function

authorize_url(client, client_id, query \\ [])

View Source

Specs

authorize_url(Dnsimple.Client.t(), String.t(), Keyword.t()) :: String.t()

Returns the URL to start the OAuth dance.

See:

Examples:

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
url = Dnsimple.Oauth.authorize_url(client, client_id = "1z2y3x", state: "12345678")
Link to this function

exchange_authorization_for_token(client, attributes, options \\ [])

View Source

Specs

exchange_authorization_for_token(Dnsimple.Client.t(), map(), keyword()) ::
  {:ok | :error, String.t()}

Returns the access token for a given authorization code.

See:

Examples:

client = %Dnsimple.Client{access_token: "a1b2c3d4"}
{:ok, response} = Dnsimple.Oauth.exchange_authorization_for_token(client, %{
  code: "authorization_code",
  state: "12345678",
  client_id: "1z2y3x",
  client_secret: "xXxXxX",
})