-
Notifications
You must be signed in to change notification settings - Fork 192
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
[Fix] Login Refresh Token to keep Users Logged In. Fixes Issue[1260] #1346
base: dev
Are you sure you want to change the base?
Conversation
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.
Fix your issues
.husky/commit-msg
Outdated
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.
Why did you touch this??
.gitignore
Outdated
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.
Why is everyone touching this file and changing this??
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.
I was unable to push to the repository. The .husky pre-commit and commit-msg prevented git commit and was unable to effectively ignore .husky file
docker-compose.yml
Outdated
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.
Why did you push this??
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.
My mistake
@@ -12,7 +12,7 @@ | |||
"start:dev": "nest start --watch", | |||
"start:debug": "nest start --debug --watch", | |||
"start:prod": "node dist/src/main", |
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.
Why did you change this??
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.
"dev": "PROFILE=local was unable to run, so I had to use "npx ts-node-dev -r dotenv/config --respawn src/main",
async login(@Body() loginDto: LoginDto): Promise<LoginResponseDto | { status_code: number; message: string }> { | ||
return this.authService.loginUser(loginDto); | ||
async login( | ||
@Body() loginDto: LoginDto, |
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.
Remove these comments.
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.
done
@@ -173,4 +187,12 @@ export default class RegistrationController { | |||
public async resetPassword(@Body() updatePasswordDto: UpdatePasswordDto) { | |||
return this.authService.updateForgotPassword(updatePasswordDto); | |||
} | |||
|
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.
Logout is being handled on the FE
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.
Okay
Removed the comments
Pull Request
Description
This PR implements secure user authentication using access tokens and refresh tokens. Users receive an access token (valid for 15 minutes) and a refresh token (valid for 7 days). The refresh token is used to generate new access tokens without requiring re-authentication. The access token is stored in an HTTP-only cookie with a
/
path, while the refresh token is stored in an HTTP-only cookie with a/auth/refresh-token
path.Related Issue
Fixes #
Type of Change
How Has This Been Tested?
Test Evidence
Screenshots (if applicable)
Checklist
Additional Notes
This implementation follows best security practices by: