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.
This commit is contained in:
Max 2025-11-04 16:52:03 +08:00
parent 30ed90d908
commit 007cf0adb9
2 changed files with 4 additions and 4 deletions

View file

@ -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

View file

@ -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":