Resuelve AuthPlug v1.4.3 ResuelveAuth.AuthPlug View Source

Plug for authentication using token signature verification.

OptionDescriptionDefault value
limit_timetime in hours168 h (1 w)
secretSecret keyempty
handlerError handler functionResuelveAuth.Sample.AuthHandler

Example


# En el archivo router.ex
defmodule MyApi.Router do

  # Using 10 hours as limit and default error handler
  @options [secret: "my-secret-key", limit_time: 10]
  use MyApi, :router

  pipeline :auth do
    plug ResuelveAuth.AuthPlug, @options
  end

  scope "/v1", MyApi do
    pipe_through([:auth])
    ..
    post("/users/", UserController, :create)
  end
end