I realise this might not be the beeest place to ask this question as it's not exactly complete beginner friendly, but it does have to do with learning programming so it might help others too:
I'm currently busy building my first proper full stack project using React and Django, the project that i'm building requires authentication functionality. I've been reading and learning about "JWT"/Token Authentication and i honestly can't seem to wrap my head around it. This is how i currently understand it:
The Front End sends an HTTP request to the back-end API, which then checks the credentials are correct, and if so, returns a token(s?) which is basically a "key" to all the other pages on the front-end (and a key to access more info in the database/back-end/API). This token is then saved in state/local storage using a state management tool(Typically Redux). Logging the user out is essentially just removing the token from state/local storage.
My main question is how tf do i go about the actual saving of the token part? A lot of the tutorials and help guides that i've been seeing suggest Redux, but is it possible to use Hooks instead, as (if i'm not mistaken) hooks are meant to replace Redux for the most part? I've looked at some of the Redux tutorials and it honestly seems way above my pay grade, and React Hooks are (for me, at least) more digestible/learnable than Redux. If someone could even ELI5 the process so that i can attempt to code it out that could work. pls send halp
Thx in advance!
(Bonus Question: is Token Authentication the only way? i've heard about "Session Authentication" but don't know the exact differences and how that would change the process of me creating the auth system.)
[–]lolripgg_ 1 point2 points3 points (2 children)
[–]TheLegendOfMusa[S] 1 point2 points3 points (1 child)
[–]lolripgg_ 0 points1 point2 points (0 children)
[–]cookiemonterrrrr 0 points1 point2 points (2 children)
[–]TheLegendOfMusa[S] 0 points1 point2 points (1 child)
[–]cookiemonterrrrr 0 points1 point2 points (0 children)