From fadd9f6168832c18cea1e16a74e3e2e1233f8241 Mon Sep 17 00:00:00 2001 From: Lakhan Samani Date: Tue, 14 Jun 2022 13:11:39 +0530 Subject: [PATCH] fix: update scope for apple login --- server/handlers/oauth_callback.go | 5 ++++- server/oauth/oauth.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/handlers/oauth_callback.go b/server/handlers/oauth_callback.go index 28a28d6..8b25618 100644 --- a/server/handlers/oauth_callback.go +++ b/server/handlers/oauth_callback.go @@ -499,8 +499,11 @@ func processAppleUserInfo(code string) (models.User, error) { } if val, ok := claims["name"]; ok { - givenName := val.(string) + nameData := val.(map[string]interface{}) + givenName := nameData["firstName"].(string) + familyName := nameData["lastName"].(string) user.GivenName = &givenName + user.FamilyName = &familyName } return user, err diff --git a/server/oauth/oauth.go b/server/oauth/oauth.go index cbfac89..a320d68 100644 --- a/server/oauth/oauth.go +++ b/server/oauth/oauth.go @@ -130,7 +130,7 @@ func InitOAuth() error { AuthURL: "https://appleid.apple.com/auth/authorize", TokenURL: "https://appleid.apple.com/auth/token", }, - Scopes: []string{"name", "email"}, + Scopes: []string{"openid", "name", "email"}, } }