From d6692f74cf3b83cab2e46269a1daa8cd93df8bb4 Mon Sep 17 00:00:00 2001 From: Ke Chen Date: Sun, 7 Jul 2024 20:26:16 +0800 Subject: [PATCH] feat: refresh api return new refresh token --- apis/token.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apis/token.go b/apis/token.go index 5b7f8f5..ab90394 100644 --- a/apis/token.go +++ b/apis/token.go @@ -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 } @@ -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", }) }