[#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
+3
View File
@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"github.com/pocketbase/pocketbase/tools/types"
"golang.org/x/oauth2"
"golang.org/x/oauth2/yandex"
)
@@ -67,6 +68,8 @@ func (p *Yandex) FetchAuthUser(token *oauth2.Token) (*AuthUser, error) {
RefreshToken: token.RefreshToken,
}
user.Expiry, _ = types.ParseDateTime(token.Expiry)
if !extracted.IsAvatarEmpty {
user.AvatarUrl = "https://avatars.yandex.net/get-yapic/" + extracted.AvatarId + "/islands-200"
}