I’m building a user authentication using this library: Phauxth and I’m trying use custom token authentication module using the guide from the docs: guide.
The default check if user is logged in or not is through accessing token in the request headers but I want to use cookie instead so I did these.
I create the custom auth module to grab the token from the cookie.
defmodule ShiritoriWeb.Auth.AuthenticateTokenCookie do
use Phauxth.Authenticate.Token
@impl true
def authenticate(%Plug.Conn{req_cookies: %{"token" => token}}, opts) do
verify_token(token, opts)
end
end
but it throws an error because verify_token/3
arguments but in the guide I based on, it uses verify_token/2
maybe I miss something but I can’t figure it out.