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:

  1. Upstream on the connection with plug Guardian.Pipeline
  2. Upstream on the connection with Guardian.Pipeline.{put_module, put_error_handler, put_key}
  3. 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