Closed patientplatypus closed 5 years ago
I'm going to try and get it to work by passing empty vals to the extra arity -
case Guardian.decode_and_verify(token, %{}, []) do
It compiles, but I'm not sure it will work.
I think you’re meant to be using a module that has use Guardian
; notice the MyApp
in the example. If you don’t access it that way, you can pass the module that has use Guardian
as the first argument to Guardian.decode_and_verify
.
I'm trying to follow this guide but it may be broken: https://gist.github.com/posilva/4fc69fcb71e463a7f00198b612522d39#file-context-ex-L30. It's non-official of course, so I think it's a misimplementation. Thanks for the help.
hmm, maybe that’s for Guardian 0.14 or older, as I see Guardian.decode_and_verify/1
in the documentation.
That is the old API, you must use your own instance of Guardian module in the latest version of Guardian.
{:ok, claims} = MyApp.Guardian.decode_and_verify(token)
This weird warning doesn't seem to follow the docs:
Code:
And check out this:
From here: https://hexdocs.pm/guardian/Guardian.html
What is going on here? Are the docs inaccurate, or is the test inaccurate? My code is very simple and it should work as it's almost a direct implementation.