View Source ExOauth2Provider.Plug (ExOauth2Provider v0.5.7)

ExOauth2Provider.Plug contains functions that assist with interacting with ExOauth2Provider via Plugs.

ExOauth2Provider.Plug is not itself a plug.

Use the helpers to look up current_access_token and current_resource_owner.

Example

ExOauth2Provider.Plug.current_access_token(conn)
ExOauth2Provider.Plug.current_resource_owner(conn)

Summary

Functions

Check if a request is authenticated

Fetch the currently verified token from the request. Optionally located at a key

Fetch the currently authenticated resource if loaded, optionally located at a key

Functions

Link to this function

authenticated?(conn, type \\ :default)

View Source
@spec authenticated?(Plug.Conn.t(), atom()) :: boolean()

Check if a request is authenticated

Link to this function

current_access_token(conn, the_key \\ :default)

View Source
@spec current_access_token(Plug.Conn.t(), atom()) ::
  ExOauth2Provider.AccessTokens.AccessToken.t() | nil

Fetch the currently verified token from the request. Optionally located at a key

Link to this function

current_resource_owner(conn, the_key \\ :default)

View Source
@spec current_resource_owner(Plug.Conn.t(), atom()) :: map() | nil

Fetch the currently authenticated resource if loaded, optionally located at a key