feat: fix user cannot logout issue about bug in GetSessionToken()

This commit is contained in:
Yang Luo
2024-03-18 02:11:39 +08:00
parent bdf9864f69
commit ae1634a4d5
4 changed files with 19 additions and 25 deletions

View File

@ -727,18 +727,19 @@ func GetWechatMiniProgramToken(application *Application, code string, host strin
return token, nil, nil
}
func GetTokenForExtension(user *User, host string) (*Token, error) {
func GetAccessTokenByUser(user *User, host string) (string, error) {
application, err := GetApplicationByUser(user)
if err != nil {
return nil, err
return "", err
}
if application == nil {
return nil, fmt.Errorf("the application for user %s is not found", user.Id)
return "", fmt.Errorf("the application for user %s is not found", user.Id)
}
token, err := GetTokenByUser(application, user, "profile", "", host)
if err != nil {
return nil, err
return "", err
}
return token, nil
return token.AccessToken, nil
}