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 摘要。