-
Notifications
You must be signed in to change notification settings - Fork 34
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
Setup authentication stacks closing #118 #180
Conversation
4fed34e
to
da301bf
Compare
da301bf
to
b38421c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @briswells, Just tested the PR, it is working as expected now. Attaching the docker log screenshot for your reference.
@MSS-Shalavritha in what context? |
Did you fetch/pull most recent changes and build the containers? Also, what is the docker console saying. I was talking with @MSS-Shalavritha last night and he was testing on a freshly built container, testing that logging in using the stock account created in dummy data. |
As @briswells mentioned, I tested on freshly built container yesterday, logged in and navigated to different webpages, it was working as expected, I retested it again today without building a new container, it still seems to be working fine. Attaching the screenshot for your reference. |
@briswells @MSS-Shalavritha what are the login credentials to verify this? Can someone please provide them, I can't login from React frontend: 3000 port. |
@AbhinavReddy-Dev, Credentials, I'm using are: Username: [email protected] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me with the credentials mentioned above.
worked with these credentials though! |
Everything is finally working together. On an login request frontend sends a post to backend who returns a JWT which gets set in local storage. When the front end calls an API route the JWT get added to the headers which the backend will use to check authentication. The token will remain until it expires allowing the user to remain logged in for the duration. The login state is being stored in a redux slice. When the app loads it checks for a valid token and if one is found sets the current user to logged in. This lets the user refresh the page and remain logged in. I'm sure there are better ways to implement this but I couldn't figure them out as I'm not a front end expert.
When the user logs out the token is removed from their local storage.
The main issue I can see right now is on a refresh other values in the userSlice are deleted, but this probably could be solved with a route to the backend that retrieves the information on a refresh. Tokens are also not removed server side until they expire, this means after someone logs out the server still would accept their token, but this can be figured out at a later point.