microsoftgraph / microsoftgraph/msgraph-sdk-java

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

オープン
#2,389 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

status:waiting-for-triage type:bug
主要言語
Java
スター
444
フォーク
154
平均マージ
18時間 28分
マージ済み PR(30日)
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. リポジトリをフォークし、ブランチを切って変更します。
  4. 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 を短くまとめたダイジェスト。