Authex

Build StatusAuthex Version

Authex is a simple JWT authentication and authorization library for Elixir.

Installation

The package can be installed by adding authex to your list of dependencies in mix.exs:

def deps do
  [
    {:authex, "~> 0.3.0"}
  ]
end

Documentation

See HexDocs for additional documentation.

Example

To get started, we must define our auth module:

defmodule MyApp.Auth do
  use Authex, opt_app: :my_app
end

We can then create, sign, and verify tokens:

token = MyApp.Auth.token(sub: 1, scopes: ["admin/read"])
compact_token = MyApp.Auth.sign(token)
{:ok, token} = MyApp.Auth.verify(compact_token)

Please check out the documentation for more advanced features like serializers, repositories and integration with plugs.

Features