UeberauthToken.Plug (ueberauth_token v0.2.0-dev)
An implementation of Ueberauth token validation in a plug pipeline
In order for there to be successful authentication, the Plug.Conn
should have a request header in the following format:
%Plug.Conn{req_headers: [%{"authorization" => "Bearer <token>"}]}
example-usage
Example Usage
Typically, UeberauthToken.Plug
would be used as part of plug pipeline
in an api for the validation phase of an oauth2 token. The client will
be in possession of a token an is making a request for a resource. This
plug validates the requests and assigns an Ueberauth
struct to the %Conn{}
pipeline :api do
plug :accepts, ["json"]
plug UeberauthToken.Plug, provider: UeberauthToken.TestProvider
end
options
Options
- * `:provider` - a module
The provider may be passed in as an option if more than one provider is
configured. The plug pipeline `plug UeberauthToken.Plug` should only be
called once in a given plug pipeline, in other words only one provider
per plug pipeline is supported.
Link to this section Summary
Link to this section Functions
Link to this function
call(conn, opts)
Callback implementation for Plug.call/2
.
Link to this function
init(opts \\ [])
Callback implementation for Plug.init/1
.