Dnsimple.Oauth (dnsimple v6.0.1)

View Source

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

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

@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")

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

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