Skip to content

Commit

Permalink
Merge pull request #201 from suryo811/fix/update-refresh-token
Browse files Browse the repository at this point in the history
update new refresh token in the db
  • Loading branch information
wajeshubham authored Oct 19, 2024
2 parents d878f30 + 6a02eb6 commit 3cb1724
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/controllers/apps/auth/user.controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ const refreshAccessToken = asyncHandler(async (req, res) => {
const { accessToken, refreshToken: newRefreshToken } =
await generateAccessAndRefreshTokens(user._id);

// Update the user's refresh token in the database
user.refreshToken = newRefreshToken;
await user.save();

return res
.status(200)
.cookie("accessToken", accessToken, options)
Expand Down

0 comments on commit 3cb1724

Please sign in to comment.