AuthToken v0.3.2 AuthToken.Plug View Source

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

Link to this section Summary

Functions

Checks authentication token from authorization header.

Link to this section Functions

Link to this function

verify_token(conn, options)

View Source
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