chore: update access token order

This commit is contained in:
Steven
2023-09-25 20:14:01 +08:00
parent ad3487a9ac
commit 745902e8b1
2 changed files with 9 additions and 8 deletions

View File

@@ -36,15 +36,15 @@ func extractTokenFromHeader(c echo.Context) (string, error) {
}
func findAccessToken(c echo.Context) string {
accessToken := ""
cookie, _ := c.Cookie(auth.AccessTokenCookieName)
if cookie != nil {
accessToken = cookie.Value
}
// Check the HTTP request header first.
accessToken, _ := extractTokenFromHeader(c)
if accessToken == "" {
accessToken, _ = extractTokenFromHeader(c)
// Check the cookie.
cookie, _ := c.Cookie(auth.AccessTokenCookieName)
if cookie != nil {
accessToken = cookie.Value
}
}
return accessToken
}