View Source Oidcc.TokenIntrospection (Oidcc v3.0.1)

OAuth Token Introspection

See https://datatracker.ietf.org/doc/html/rfc7662

Telemetry

  • [:oidcc, :introspect_token, :start]

    • Description: Emitted at the start of introspecting the token
    • Measurements: %{system_time: non_neg_integer(), monotonic_time: integer()}
    • Metadata: %{issuer: :uri_string.uri_string(), client_id: String.t()}
  • [:oidcc, :introspect_token, :stop]

    • Description: Emitted at the end of introspecting the token
    • Measurements: %{duration: integer(), monotonic_time: integer()}
    • Metadata: %{issuer: :uri_string.uri_string(), client_id: String.t()}
  • [:oidcc, :introspect_token, :exception]

    • Description: Emitted at the end of introspecting the token
    • Measurements: %{duration: integer(), monotonic_time: integer()}
    • Metadata: %{issuer: :uri_string.uri_string(), client_id: String.t()}

Summary

Functions

Introspect the given access token

Types

@type t() :: %Oidcc.TokenIntrospection{
  active: boolean(),
  client_id: binary(),
  exp: pos_integer(),
  scope: :oidcc_scope.scopes(),
  username: binary()
}

Functions

Link to this function

introspect(token, client_context, opts \\ %{})

View Source (since 3.0.0)
@spec introspect(
  token :: String.t() | Oidcc.Token.t(),
  client_context :: Oidcc.ClientContext.t(),
  opts :: :oidcc_token_introspection.opts()
) :: {:ok, t()} | {:error, :oidcc_token_introspection.error()}

Introspect the given access token

For a high level interface using Oidcc.ProviderConfiguration.Worker see Oidcc.introspect_token/5.

Examples

iex> {:ok, pid} =
...>   Oidcc.ProviderConfiguration.Worker.start_link(%{
...>     issuer: "https://api.login.yahoo.com"
...>   })
...>
...> {:ok, client_context} =
...>   Oidcc.ClientContext.from_configuration_worker(
...>     pid,
...>     "client_id",
...>     "client_secret"
...>   )
...>
...> Oidcc.TokenIntrospection.introspect(
...>   "access_token",
...>   client_context
...> )
...> # => {:ok, %Oidcc.TokenIntrospection{}}