1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-12-02 17:33:36 +02:00

[#385] added username to the OAuth2 AuthUser model

This commit is contained in:
Gani Georgiev
2022-09-05 16:15:27 +03:00
parent b717896232
commit b79a7982bf
5 changed files with 9 additions and 1 deletions

View File

@@ -32,6 +32,7 @@ func NewGithubProvider() *Github {
func (p *Github) FetchAuthUser(token *oauth2.Token) (*AuthUser, error) {
// https://docs.github.com/en/rest/reference/users#get-the-authenticated-user
rawData := struct {
Login string `json:"login"`
Id int `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
@@ -45,6 +46,7 @@ func (p *Github) FetchAuthUser(token *oauth2.Token) (*AuthUser, error) {
user := &AuthUser{
Id: strconv.Itoa(rawData.Id),
Name: rawData.Name,
Username: rawData.Login,
Email: rawData.Email,
AvatarUrl: rawData.AvatarUrl,
}