Skip to content

Commit

Permalink
feat: refresh api return new refresh token
Browse files Browse the repository at this point in the history
  • Loading branch information
JingYiJun committed Jul 7, 2024
1 parent d9d406c commit d6692f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apis/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func Logout(c *fiber.Ctx) error {
// @Router /refresh [post]
// @Success 200 {object} TokenResponse
func Refresh(c *fiber.Ctx) error {
refreshToken, user, err := GetUserByRefreshToken(c)
_, user, err := GetUserByRefreshToken(c)
if err != nil {
return err
}
Expand All @@ -126,14 +126,14 @@ func Refresh(c *fiber.Ctx) error {
return err
}

access, _, err := user.CreateJWTToken()
access, refresh, err := user.CreateJWTToken()
if err != nil {
return err
}

return c.JSON(TokenResponse{
Access: access,
Refresh: refreshToken, // using old refreshToken instead
Refresh: refresh, // using new refreshToken
Message: "refresh successful",
})
}

0 comments on commit d6692f7

Please sign in to comment.