View Source BtrzAuth.Plug.VerifyProviders (BtrzAuth v1.3.0)
Looks for and validates if there are provider_ids
in the query params and if they are valids with the account data under conn.private.account
saved by BtrzAuth.Plug.VerifyApiKey
(the order of the plugs is very important!)
This plug will look for providerId
or provider_id
or a list of comma separated ids in providerIds
or
provider_ids
.
This, like all other Guardian plugs, requires a Guardian pipeline to be setup.
It requires an error handler as error_handler
.
These can be set either:
- Upstream on the connection with
plug Guardian.Pipeline
- Upstream on the connection with
Guardian.Pipeline.{put_module, put_error_handler, put_key}
- Inline with an option of
:module
,:error_handler
,:key
If any provider is invalid, the pipeline will be halted and an error with status 400 will be set in the conn.resp_body
like this:
%{
"status" => 400,
"code" => "INVALID_PROVIDER_ID",
"message" => "Error getting provider"
}
Example
plug BtrzAuth.Plug.VerifyProviders
Summary
Functions
@spec call(Plug.Conn.t(), Keyword.t()) :: Plug.Conn.t()