Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#2,389 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
java

Línea de trabajo

Empieza con getUserProfile y la llamada graphClient.me().get(); después, inspecciona cómo User.getMail() asigna la respuesta del perfil de Microsoft Graph. Compara el comportamiento del alias y de la dirección real reportados con los scopes indicados y el comportamiento actual del SDK. Se considera terminado cuando la búsqueda del perfil devuelve la dirección esperada o documenta claramente la limitación de la API, con una prueba de regresión si el SDK controla la asignación.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

status:waiting-for-triage type:bug
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_
Lenguaje dominante
Java
Estrellas
444
Forks
154
Merge medio
18 h 28 min
PR fusionados (30 d)
4

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoftgraph/msgraph-sdk-java

Todos los issues de microsoftgraph/msgraph-sdk-java

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.