TokenAuth

A Plug that provides Bearer authentication by checking the requests' token matches the configured one.

Installation

{:token_auth, "~> 1.0.0"}

Usage

Plug it in your router or pipeline:

plug(TokenAuth)

Then in you config:

config :token_auth,
token: {:system, "AUTH_TOKEN", "token"},
realm: {:system, "AUTH_REALM", "Authentication"}

It works with any env name:

config :token_auth,
token: {:system, "APP_TOKEN", "token"},
realm: {:system, "APP_REALM", "Authentication"}