wxapp login

This commit is contained in:
richboo111
2022-12-01 11:22:46 +08:00
parent 874d2ffc76
commit 3e3c623ebc
3 changed files with 38 additions and 3 deletions

View File

@@ -70,6 +70,18 @@ func (a *Auther) VerifySecret(id, secret string) (authBindEx *auth2.AuthBindEx,
} else {
err = ErrStateIsWrong
}
} else if a.authType == AuthTypeWxApp {
state := id
code := jsCode
if state == "" {
token, err2 := a.getAPI().SNSRetrieveToken(code)
if err = err2; err == nil {
openID = token.OpenID
accessToken = token.AccessToken
}
} else {
err = ErrStateIsWrong
}
} else {
openID = id
accessToken = secret