Boruta core v1.0.0-rc.2 Boruta.Oauth.Introspect View Source

OAuth Introspect

Link to this section Summary

Functions

Build an introspect response for the given IntrospectRequest

Link to this section Functions

Link to this function

token(introspect_request)

View Source

Specs

token(
  request :: %Boruta.Oauth.IntrospectRequest{
    client_id: String.t(),
    client_secret: String.t(),
    token: String.t()
  }
) ::
  {:ok, token :: Boruta.Oauth.Token.t()}
  | {:error, error :: Boruta.Oauth.Error.t()}

Build an introspect response for the given IntrospectRequest

Note : Invalid tokens returns an error {:error, %Error{error: :invalid_access_token, ...}}. That must be rescued to return %{"active" => false} in application implementation.

Examples

iex> token(%IntrospectRequest{
  client_id: "client_id",
  client_secret: "client_secret",
  token: "token"
})
{:ok, %Token{...}}