Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using sans_password to make an authenticated API #4

Open
mazz opened this issue Sep 11, 2018 · 0 comments
Open

Using sans_password to make an authenticated API #4

mazz opened this issue Sep 11, 2018 · 0 comments

Comments

@mazz
Copy link

mazz commented Sep 11, 2018

Great library.

I got login, email and magic tokens working and would like to know a secure way to implement a JWT API on top of it.

What I’m thinking is, the user can POST with their email address in the header of the POST. The app can then do

{:ok, magic_token, _claims} = MyApp.Guardian.send_magic_link(user)

Not email anything at this point but rather exchange_magic() in the same function:

{:ok, access_token, _claims} = MyApp.Guardian.exchange_magic(magic_token)

So at this point if either of the two calls above fail, the app just sends back a 401 or 403.

Is this sensible or even possible?

What I mean by a JWT API is something like here:

https://dev.to/miguelcoba/elixir-api-and-elm-spa---part-2-1pca

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant