Using Non Elixir for Authentication

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.

Yes, just make a plug that grabs the JWT from the cookie or whatever and verifies it with Joken.

Basically like this:

(Edit: looks like Joken even comes with pre-made plugs now)

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

Thanks @potatosalad