ExOauth2Provider v0.3.0 ExOauth2Provider.Token View Source

Handler for dealing with generating access tokens.

Link to this section Summary

Functions

Grants an access token based on grant_type strategy

Revokes an access token as per http://tools.ietf.org/html/rfc7009

Link to this section Functions

Link to this function grant(request) View Source
grant(Map.t()) :: {:ok, Ecto.Schema.t()} | {:error, Map.t(), term()}

Grants an access token based on grant_type strategy.

Example

ExOauth2Provider.Token.authorize(resource_owner, %{
  "grant_type" => "invalid",
  "client_id" => "Jf5rM8hQBc",
  "client_secret" => "secret"
})

Response

{:error, %{error: error, error_description: description}, http_status}
Link to this function revoke(request) View Source
revoke(Map.t()) :: {:ok, Ecto.Schema.t()} | {:error, Map.t(), term()}

Revokes an access token as per http://tools.ietf.org/html/rfc7009

Example

ExOauth2Provider.Token.revoke(resource_owner, %{
  "client_id" => "Jf5rM8hQBc",
  "client_secret" => "secret",
  "token" => "fi3S9u"
})

Response

{:ok, %{}}