mtangoo
September 3, 2017, 12:42pm
#1
I’m planning to write my little project in Elixir with Phoenix framework.
The Project is building on already existing auth component written in a different language.
Is there a way to authenticate Phoenix requests with a token (JWT) that was not generated by phoenix?
My apologies if it the answer is obvious.
dom
September 3, 2017, 2:01pm
#2
Yes, just make a plug that grabs the JWT from the cookie or whatever and verifies it with Joken .
Basically like this: http://luk3thomas.com/authentiation-in-elixir-plug-20160722.html
(Edit: looks like Joken even comes with pre-made plugs now)
mtangoo
September 3, 2017, 3:11pm
#3
Thanks.
It seems easier than I thought. One thing that have caught my eyes is the note by the author:
“Be advised though that this is a work in progress by @potatosalad .”
I will try to read Guradian to see if this is possible with it
Guardian also uses jose as a dependency, similar to Joken.
If you do run into any issues getting things to work, feel free to file an issue on GitHub or ask on here. Good luck!
1 Like