-
Notifications
You must be signed in to change notification settings - Fork 1
feat(auth): [#2] Implement user login with JWT #14
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
178126c
feat(auth): create login user dto
Zafar7645 e22ff9a
feat(auth): install and configure jwt module
Zafar7645 92ad1d8
fix(backend): update jwt configuration to import config module and in…
Zafar7645 9605720
feat(auth): implement user login endpoint with JWT
Zafar7645 198bf4b
test(auth): add unit tests for user login with jwt
Zafar7645 3bc4e00
fix(backend): apply all suggestions from automated code review
Zafar7645 0cb4404
refactor(test): remove redundant promise calls
Zafar7645 90f42f7
refactor(backend): use absolute imports
Zafar7645 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
🧩 Analysis chain
Verify if passport core package is required.
You've added
passport-jwtbut there's nopassportcore package in dependencies. If you're using passport-jwt strategy, you typically need the passport core package as well.Run the following script to check if passport is already present or if passport-jwt works standalone in your implementation:
🏁 Script executed:
Length of output: 0
I need to gather more comprehensive information about the codebase to verify this dependency concern.
🏁 Script executed:
Length of output: 66
🏁 Script executed:
Length of output: 33
🏁 Script executed:
Length of output: 31
🏁 Script executed:
Length of output: 235
🏁 Script executed:
Length of output: 727
🏁 Script executed:
Length of output: 2918
🏁 Script executed:
Length of output: 96
🏁 Script executed:
Length of output: 1164
Remove unused
passport-jwtdependency and its type definitions.The codebase uses
@nestjs/jwtfor JWT authentication (seeauth.module.tsandauth.service.ts). Thepassport-jwtpackage is not imported or used anywhere in the implementation, making it an unused dependency. Remove"passport-jwt": "^4.0.1"and"@types/passport-jwt": "^4.0.1"fromapps/backend/package.json.🤖 Prompt for AI Agents
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.
You're right that passport-jwt isn't used yet.
While @nestjs/jwt handles the creation of tokens (which is done in the login function), passport-jwt is the standard library used with NestJS's AuthGuard to validate incoming tokens and protect routes.
I've included it now because the next step, after login, will be to implement route protection using AuthGuard('jwt'), which requires passport-jwt as its underlying strategy. Keeping it ensures the necessary dependency is ready for that implementation.
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.