bas652

bas652

Code review for authentication flow

Hi Everyone!

I’m still new to the Elixir and Phoenix world, so I’m trying to make an API as a learning project, but in the end I got a bit confused while trying to work out an authentication flow with Guardian. In the end I managed to create a working prototype (without token revocation but I plan on building it later), but I am not sure if my code follows best practices, and would love some advice if someone is willing to review it. The most confusing thing was the pipeline and the error handling for me, so if somebody takes a look on that, that’s a great help already

All feedback is greatly appreciated! I made a PR for myself on github, you can take a look at it here:
https://github.com/blascsi/redoist-backend/pull/1

Most Liked

OvermindDL1

OvermindDL1

Guardian is designed for tokens specifically that don’t hit the database, I.E. it makes no sense for it to have revocation, rather a very short timeout between non-communicating servers is their general use, not single server API’s. It sounds like you just want to use normal Phoenix.Token’s.

siddhant3030

siddhant3030

Where Next?

Popular in Questions Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

Other popular topics Top

New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

We're in Beta

About us Mission Statement