-
Notifications
You must be signed in to change notification settings - Fork 2
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
Feature/auth #65
Feature/auth #65
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
…status client side
@Dan-Y-Ko
Need to extract Maybe it would be more convenient to get jwt token from the res body. idk I can get this cookie in my directoryService so I think everything is working great, but still need |
This is probably better. We want to get the cookie from the headers. I can't remember why I didn't do that in the first place. As for expiry, ideally we'd want that too. One thing I didn't implement is route redirection if the user types in the url unauthenticated, but this theoretically should be pretty simple to do. We can disable the links client side in the UI but we'll have to take care of url redirection too. |
Expiry is important, we probably need to write some logic for checking if a token is expired.
I think we can do it. |
Description
Setup authentication utilizing server actions and http only cookies. Not storing any tokens on the frontend. Auth state is persisted on refresh through calling an endpoint in the backend to check if user can access it (which means they're authenticated).
Added max-age on nextjs cookie to same value as one sent from api.
Added middleware to redirect unauthenticated user if they try to access a protected route. Currently only setup my voyage pages as protected routes because I'm not sure how we want to handle the other routes yet.
Added vercel build script to deploy to vercel only when pushed to dev/staging/main. This is so we don't have tons of unnecessary deployments when pushing to feature branches.
Did husky setup from scratch again, hopefully it works this time. Added a build step to husky. Since we are not deploying to vercel on feature branches anymore, that means the build script isn't being run but it's crucial to run this every time so instead it'll be executed locally.
Issue link
Fixes # (issue)
Type of change
How Has This Been Tested?
I tested through localhost and deployed url.
Checklist: