Closed shahryarjb closed 6 years ago
The two issues that are causing Guardian not to work for you are:
In your pipeline you're setting the module
to ApiTrangell.Tokens
but this module does not exist. You should change this to: ApiTrangell.Guardian
In ApiTrangell
you do not have the function you're trying to call in ApiTrangell.Guardian
You'll need to implement that.
For your application it would be as simple as:
defmodule ApiTrangell do
def get_resource_by_id(id) do
%{id: id, user: "shahryar"}
end
end
A couple of other things though that are just general good practices. You should have a .gitignore and include at least _build
and deps
in it. That repo has them checked in :(
Nested routes in your router are not something that is encouraged. It makes it very difficult to work out what's going on when your application grows a bit.
Hi, My token shows me
{"message":"invalid_token"}
when I send request and my pipeline don't recognise it. I guess my problem isplug Guardian.Plug.VerifyHeader, realm: "Bearer"
, but I dont know how to fix it.My request image : https://devheroes.club/uploads/default/original/1X/28f63c2ff97e12a4763ecd317b0481396aa32142.png
E.x :
Or :
My pipeline :
My project repositorie link: https://github.com/shahryarjb/ESOGIP
Thanks