microsoftgraph / microsoftgraph/msgraph-sdk-java

getMail() method is returning the email alias instead of real email address

未關閉
#2,389 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

status:waiting-for-triage type:bug
主要語言
Java
星號
444
分支
154
平均合併
18 小時 28 分鐘
30 天內合併 PR
4

描述

Describe the bug

I'm using the SDK in order to allow the user to get authenticated on my platform.

The problem that I'm facing is that the getMail() is returning the email alias instead of the real email. For example:

  • user get authenticated using the account danielrealuser@gmail.com;
  • the user get authenticated, however, the real email address is randomvalue@outlook.com;
  • instead or returning randomvalue@outlook.com it returns danielrealuser@gmail.com.
Expected behavior

When requesting the data regarding the user, it should return the real user email in the property getMail, however, it gets the alias used to authenticate on Outlook.

How to reproduce

These are the scopes that I'm using (and I'll user more later not related to this topic):
"email",
"Mail.Read",
"Mail.Read.Shared",
"Mail.ReadBasic",
"Mail.ReadBasic.Shared",
"offline_access",
"openid",
"profile",
"User.Read.all",
"User.ReadBasic.All",
"ExternalUserProfile.Read.All"

Code implementation

    public User getUserProfile(String accessToken) {
        GraphServiceClient graphClient = createGraphServiceClient(accessToken);
        return graphClient.me().get();
    }

            IAuthenticationResult authResult = this.exchangeCodeForTokens(authCode);
            User user = this.getUserProfile(authResult.accessToken());

            // Get user profile using the access token
            return new MicrosoftUserData(
                    user.getId(),
                    user.getGivenName(),
                    user.getSurname(),
                    user.getMail(),
                    authResult.accessToken(),
                    authResult.accessToken(), // Use refresh token instead of access token twice
                    user.getDisplayName(),
                    getProfilePictureDataUrl(authResult.accessToken())
            );

SDK Version

No response

Latest version known to work for scenario above?

6.40.0

Known Workarounds

No response

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 getUserProfile 和 graphClient.me().get() 呼叫開始,接著檢查 User.getMail() 如何對應 Microsoft Graph 設定檔回應。將回報的別名和實際位址行為與列出的 scopes 以及目前的 SDK 行為進行比較。完成的標準是設定檔查詢傳回預期的位址,或明確記錄 API 限制;如果 SDK 控制對應,則加入回歸測試。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java
領域
api, authentication
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。