Resuelve AuthPlug v1.4.3 ResuelveAuth.AuthPlug View Source
Plug for authentication using token signature verification.
Option | Description | Default value |
---|---|---|
limit_time | time in hours | 168 h (1 w) |
secret | Secret key | empty |
handler | Error handler function | ResuelveAuth.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