Phoenix API Toolkit v0.8.0 API Reference

Modules

Store the raw body for verification purposes. Use as Plug.Parsers :body_reader option in endpoint pipeline.

Dynamic filtering of Ecto queries is useful for creating list/index functions, and ultimately list/index endpoints, that accept a map of filters to apply to the query. Such a map can be based on HTTP query parameters, naturally.

Generic queries are applicable to any named binding in a query. By using generic queries, it is not necessary to implement standard queries for every Ecto model.

Generic validators and helper functions for validating Ecto changesets.

Request validator for generic (REST) requests. Meant to supplement database-level Ecto changesets. For example when creating a new entity, your database contexts / changesets will do their own validations and it would be useless to do so an extra time.

Checks HMAC authentication. Expects a HMAC- of the request body to be present in the "authorization" header. Supported algorithms are those supported by :crypto.hmac/3. Relies on PhoenixApiToolkit.CacheBodyReader being called by Plug.Parsers.

Plug to verify an Oauth2 JWT. The JWT must be passed to the application in the authorization request header prefixed with Bearer:. The Plug must be configured with a set of JSON Web Keys used to sign the JWT's, a whitelist of algorithms that may be used to sign the JWT and the expected issuer. The optional dummy_verify setting can be used to skip JWT verification for development and testing. Requires :jose dependency in your mix.exs file.

Security-related plugs.

Various helper functions for writing tests.

Generic utility functions.

Exceptions

Error raised the HMAC used to sign a request body is invalid

Error raised when a content-carrying request does not have a content-type header.

Error raised when an Oauth2 token is invalid