Guardian v0.13.0 Guardian.Plug.VerifyHeader
Use this plug to verify a token contained in the header.
You should set the value of the Authorization header to:
Authorization: <jwt>
Example
plug Guardian.Plug.VerifyHeader
Example
plug Guardian.Plug.VerifyHeader, key: :secret
Verifying the session will update the claims on the request, available with Guardian.Plug.claims/1
In the case of an error, the claims will be set to { :error, reason }
A “realm” can be specified when using the plug. Realms are like the name of the token and allow many tokens to be sent with a single request.
plug Guardian.Plug.VerifyHeader, realm: "Bearer"
When a realm is not specified, the first authorization header found is used, and assumed to be a raw token
example
plug Guardian.Plug.VerifyHeader
# will take the first auth header
# Authorization: <jwt>