talira

Guardian

A token based authentication library for Elixir applications

open sourceMITfree

Guardian is a token based authentication library for Elixir. It supports JSON Web Tokens out of the box and any other token type that implements its Guardian.Token behaviour, and authenticates web endpoints through Plug and Phoenix, Phoenix channels and sockets, or anything else that can carry a token. An application can configure several token types, each with its own claims.

Problems it solves

  • add token based login to my Phoenix API
  • authenticate Phoenix channel connections with a signed token
  • issue and verify JWTs for users in my Elixir app
  • protect some routes in my Elixir web app so only signed-in users reach them

Features

  • JSON Web Tokens by default, other token types through a behaviour
  • Plug pipelines for Phoenix and other web apps
  • authentication for Phoenix channels and sockets
  • several token types and configurations in one application
  • custom claims in tokens

Alternatives

The same job

These do what Guardian does.

  1. Joken JSON Web Token (JWT) library for Elixir
  2. JOSE (Erlang and Elixir) JSON Object Signing and Encryption for Erlang and Elixir
  3. OAuth2 (Elixir) An Elixir OAuth 2.0 client library

Compare Guardian with the top 3