View Source BtrzAuth.Plug.VerifyPremium (BtrzAuth v1.3.0)

Looks for and validates that the passed keys features are present in the account data under conn.private.account["premium"] saved by BtrzAuth.Plug.VerifyApiKey (the order of the plugs is very important!)

If the premium keys are not found under conn.private.account, the pipeline will be halted and the conn.resp_body with:

%{
  "error" => "unauthorized",
  "reason" => "premium_not_verified"
}

Options:

  • keys - list of atom premium features to verify. Defaults to: []

Example

plug BtrzAuth.Plug.VerifyPremium, keys: [:special_content]

Summary

Functions