1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-12-04 18:09:42 +02:00

[#3617] added expiry field to the OAuth2 user

This commit is contained in:
Gani Georgiev
2023-11-27 20:32:28 +02:00
parent 3b79535dc7
commit 99bdb4e701
23 changed files with 70 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import (
"io"
"strconv"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
"golang.org/x/oauth2/github"
)
@@ -67,6 +68,8 @@ func (p *Github) FetchAuthUser(token *oauth2.Token) (*AuthUser, error) {
RefreshToken: token.RefreshToken,
}
user.Expiry, _ = types.ParseDateTime(token.Expiry)
// in case user has set "Keep my email address private", send an
// **optional** API request to retrieve the verified primary email
if user.Email == "" {