From 43cadd7f42690c6ce69d02a1e7786ea1710dc706 Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Sun, 18 May 2025 10:57:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BE=AE=E8=BD=AF=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E7=99=BB=E5=BD=95=EF=BC=8C=E6=9C=AA=E6=B5=8B?= =?UTF-8?q?=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proto/tool.go | 19 +++++++++++++------ service/toolService.go | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/proto/tool.go b/proto/tool.go index aefa66f..6055a5b 100644 --- a/proto/tool.go +++ b/proto/tool.go @@ -358,11 +358,18 @@ type MicrosoftOAuthRequest struct { RedirectURI string `json:"redirect_uri"` GrantType string `json:"grant_type"` // authorization_code } + type MicrosoftUserInfo struct { - Sub string `json:"sub"` - Name string `json:"name"` - PreferredUsername string `json:"preferred_username"` - Email string `json:"email"` - Picture string `json:"picture"` - Groups interface{} `json:"groups"` + OdataContext string `json:"@odata.context"` + BusinessPhones []string `json:"businessPhones"` + DisplayName string `json:"displayName"` + GivenName string `json:"givenName"` + JobTitle interface{} `json:"jobTitle"` + Mail interface{} `json:"mail"` + MobilePhone interface{} `json:"mobilePhone"` + OfficeLocation interface{} `json:"officeLocation"` + PreferredLanguage string `json:"preferredLanguage"` + Surname string `json:"surname"` + UserPrincipalName string `json:"userPrincipalName"` + ID string `json:"id"` } diff --git a/service/toolService.go b/service/toolService.go index 34aadd9..0a66670 100644 --- a/service/toolService.go +++ b/service/toolService.go @@ -729,7 +729,7 @@ func DoMicroSoftCallBack(state *proto.ThirdPartyLoginState, code string) { thirdPartyLoginStatus.Status = proto.ParameterError } else { log.Printf("get %s user info:%v\n", state.Platform, userInfoResp) - thirdPartyUserInfo := proto.ThirdPartyUserInfo{UserID: userInfoResp.Sub, Name: userInfoResp.Name, Avatar: userInfoResp.Picture, Email: userInfoResp.Email} + thirdPartyUserInfo := proto.ThirdPartyUserInfo{UserID: userInfoResp.ID, Name: userInfoResp.DisplayName, Avatar: "", Email: ""} HandleThirdPartyLoginStatusV2(state, &thirdPartyLoginStatus, &thirdPartyUserInfo) thirdPartyLoginStatus.Status = proto.SuccessCode }