From 007cf0adb954869ee84267895cdac19e6babd44c Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 4 Nov 2025 16:52:03 +0800 Subject: [PATCH] Update token scope references in user entry and login processes - Changed token scope from `ScopeInviteVerification` to `ScopeEntryVerification` in both `GinVerifyInvite` and `LoginByUserID` functions to align with updated authorization requirements. - Updated error messages to reflect the new expected scope for improved clarity in responses. --- openapi/user/entry.go | 4 ++-- openapi/user/login.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openapi/user/entry.go b/openapi/user/entry.go index 21c083df..2e49886c 100644 --- a/openapi/user/entry.go +++ b/openapi/user/entry.go @@ -1083,10 +1083,10 @@ func GinVerifyInvite(c *gin.Context) { // Get authorized info from the temporary token authInfo := oauth.GetAuthorizedInfo(c) - if authInfo == nil || authInfo.Scope != ScopeInviteVerification { + if authInfo == nil || authInfo.Scope != ScopeEntryVerification { errorResp := &response.ErrorResponse{ Code: response.ErrInsufficientScope.Code, - ErrorDescription: "Invalid or missing token scope. Expected invite_verification scope", + ErrorDescription: "Invalid or missing token scope. Expected entry_verification scope", } response.RespondWithError(c, response.StatusForbidden, errorResp) return diff --git a/openapi/user/login.go b/openapi/user/login.go index dabd50c3..2f156e95 100644 --- a/openapi/user/login.go +++ b/openapi/user/login.go @@ -176,7 +176,7 @@ func LoginByUserID(userid string, loginCtx *LoginContext) (*LoginResponse, error extraClaims["remember_me"] = true } - accessToken, err := oauth.OAuth.MakeAccessToken(yaoClientConfig.ClientID, ScopeInviteVerification, subject, inviteExpire, extraClaims) + accessToken, err := oauth.OAuth.MakeAccessToken(yaoClientConfig.ClientID, ScopeEntryVerification, subject, inviteExpire, extraClaims) if err != nil { return nil, err } @@ -186,7 +186,7 @@ func LoginByUserID(userid string, loginCtx *LoginContext) (*LoginResponse, error AccessToken: accessToken, ExpiresIn: inviteExpire, TokenType: "Bearer", - Scope: ScopeInviteVerification, + Scope: ScopeEntryVerification, Status: LoginStatusInviteVerification, }, nil case "active":