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 }