View Source Dnsimple.Oauth (dnsimple v4.0.0)

Provides functions to authenticate through the OAuth web application flow.

See:

Summary

Functions

Returns the URL to start the OAuth dance.

Returns the access token for a given authorization code.

Functions

Link to this function

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

View Source
@spec 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
@spec 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",
})