mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-04-21 23:45:45 +02:00
updated Google OAuth2 endpoints
This commit is contained in:
parent
0aa21c1d04
commit
accc51bf65
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,9 +1,19 @@
|
|||||||
## v0.25.0 (WIP)
|
## v0.25.0 (WIP)
|
||||||
|
|
||||||
- Added JSVM `new Timezone(name)` binding for constructing `time.Location` value ([#6219](https://github.com/pocketbase/pocketbase/discussions/6219)).
|
- ⚠️ Upgraded Google OAuth2 auth, token and userinfo endpoints to their latest versions.
|
||||||
|
_For users that doesn't do anything custom with the Google account response or the `urlCallback`, this should be a non-breaking change. The exceptions that I could find are:_
|
||||||
|
- `/v3/userinfo` auth response changes:
|
||||||
|
```
|
||||||
|
meta.rawUser.id => meta.rawUser.sub
|
||||||
|
meta.rawUser.verified_email => meta.rawUser.email_verified
|
||||||
|
```
|
||||||
|
- `/v2/auth` query parameters changes:
|
||||||
|
if you are specifying custom `approval_prompt=force` query parameter in the `urlCallback`, you'll have to replace it with `prompt=consent`
|
||||||
|
|
||||||
- Upgraded to `golang-jwt/jwt/v5`.
|
- Upgraded to `golang-jwt/jwt/v5`.
|
||||||
|
|
||||||
|
- Added JSVM `new Timezone(name)` binding for constructing `time.Location` value ([#6219](https://github.com/pocketbase/pocketbase/discussions/6219)).
|
||||||
|
|
||||||
|
|
||||||
## v0.24.2 (WIP)
|
## v0.24.2 (WIP)
|
||||||
|
|
||||||
|
@ -32,9 +32,9 @@ func NewGoogleProvider() *Google {
|
|||||||
"https://www.googleapis.com/auth/userinfo.profile",
|
"https://www.googleapis.com/auth/userinfo.profile",
|
||||||
"https://www.googleapis.com/auth/userinfo.email",
|
"https://www.googleapis.com/auth/userinfo.email",
|
||||||
},
|
},
|
||||||
authURL: "https://accounts.google.com/o/oauth2/auth",
|
authURL: "https://accounts.google.com/o/oauth2/v2/auth",
|
||||||
tokenURL: "https://accounts.google.com/o/oauth2/token",
|
tokenURL: "https://oauth2.googleapis.com/token",
|
||||||
userInfoURL: "https://www.googleapis.com/oauth2/v1/userinfo",
|
userInfoURL: "https://www.googleapis.com/oauth2/v3/userinfo",
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,11 +51,11 @@ func (p *Google) FetchAuthUser(token *oauth2.Token) (*AuthUser, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extracted := struct {
|
extracted := struct {
|
||||||
Id string `json:"id"`
|
Id string `json:"sub"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Email string `json:"email"`
|
|
||||||
Picture string `json:"picture"`
|
Picture string `json:"picture"`
|
||||||
VerifiedEmail bool `json:"verified_email"`
|
Email string `json:"email"`
|
||||||
|
EmailVerified bool `json:"email_verified"`
|
||||||
}{}
|
}{}
|
||||||
if err := json.Unmarshal(data, &extracted); err != nil {
|
if err := json.Unmarshal(data, &extracted); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -72,7 +72,7 @@ func (p *Google) FetchAuthUser(token *oauth2.Token) (*AuthUser, error) {
|
|||||||
|
|
||||||
user.Expiry, _ = types.ParseDateTime(token.Expiry)
|
user.Expiry, _ = types.ParseDateTime(token.Expiry)
|
||||||
|
|
||||||
if extracted.VerifiedEmail {
|
if extracted.EmailVerified {
|
||||||
user.Email = extracted.Email
|
user.Email = extracted.Email
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user