View Source AuthToken.Plug (AuthToken v0.4.0)

Plugs for AuthToken

Examples

import AuthToken.Plug

pipeline :auth do
  plug :verify_token
end

scope "/protected/route", MyApp do
  pipe_through :auth

  resources "/", DoNastyStuffController
end

Summary

Functions

Checks authentication token from authorization header.

Functions

Link to this function

verify_token(conn, options)

View Source
@spec verify_token(Plug.Conn.t(), any()) :: Plug.Conn.t()

Checks authentication token from authorization header.

If this fails, send 401 with message "error": "auth_fail" or "error": "timeout" as JSON