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

@ -45,7 +45,6 @@ func InitDb() {
}
initWebAuthn()
initToken()
}
func getBuiltInAccountItems() []*AccountItem {
@ -310,10 +309,6 @@ func initWebAuthn() {
gob.Register(webauthn.SessionData{})
}
func initToken() {
gob.Register(&Token{})
}
func initBuiltInUserModel() {
model, err := GetModel("built-in/user-model-built-in")
if err != nil {

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
}