microsoftgraph / microsoftgraph/msgraph-sdk-java
Can not make request after migrating to V6 from V5
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Java
- Estrellas
- 444
- Forks
- 154
- Merge medio
- 18 h 28 min
- PR fusionados (30 d)
- 4
Descripción
I followed the migration instruction here. After the migration to V6.21, I can not make any request to Azure B2C.
This is the error I am getting:
java.lang.NoSuchMethodError: 'com.azure.core.credential.TokenRequestContext com.azure.core.credential.TokenRequestContext.setCaeEnabled(boolean)'
at com.microsoft.kiota.authentication.AzureIdentityAccessTokenProvider.getAuthorizationToken(AzureIdentityAccessTokenProvider.java:161) ~[microsoft-kiota-authentication-azure-1.7.0.jar:na]
at com.microsoft.kiota.authentication.BaseBearerTokenAuthenticationProvider.authenticateRequest(BaseBearerTokenAuthenticationProvider.java:46) ~[microsoft-kiota-abstractions-1.7.0.jar:na]
at com.microsoft.kiota.http.OkHttpRequestAdapter.getHttpResponseMessage(OkHttpRequestAdapter.java:710) ~[microsoft-kiota-http-okHttp-1.7.0.jar:na]
at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:275) ~[microsoft-kiota-http-okHttp-1.7.0.jar:na]
at com.microsoft.graph.users.item.UserItemRequestBuilder.get(UserItemRequestBuilder.java:761) ~[microsoft-graph-6.20.0.jar:na]
at com.microsoft.graph.users.item.UserItemRequestBuilder.get(UserItemRequestBuilder.java:747) ~[microsoft-graph-6.20.0.jar:na]
I also try the latest kiota version 1.8.x but it did not help.
What am I missing here?
Here are the changes regarding the authentication:
@Configuration
public class GraphConfiguration {
private static final String SCOPE = "https://graph.microsoft.com/.default";
@Bean
public GraphServiceClient graphClient(AadAuthenticationProperties aadAuthenticationProperties) throws Exception {
ClientSecretCredential credential = new ClientSecretCredentialBuilder()
.clientId(aadAuthenticationProperties.getCredential().getClientId())
.clientSecret(aadAuthenticationProperties.getCredential().getClientSecret())
.tenantId(aadAuthenticationProperties.getProfile().getTenantId())
.build();
if (null == scopes || null == credential) {
throw new Exception("Unexpected error while initializing GraphServiceClient");
}
return new GraphServiceClient(credential, SCOPE);
}
}
And the call looks like this:
public void getLoggedInUserInfo() {
var users = graphServiceClient
.users
.get();
}
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con la llamada users.get() reportada y los puntos de entrada del stack trace en AzureIdentityAccessTokenProvider y OkHttpRequestAdapter. Inspecciona las versiones resueltas de las dependencias de Azure Core y Microsoft Graph/Kiota en torno a TokenRequestContext.setCaeEnabled(boolean) y, después, reproduce la solicitud con la GraphConfiguration mostrada. El trabajo estará terminado cuando el cliente migrado pueda realizar la solicitud de Azure B2C sin el NoSuchMethodError reportado.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- azure, java
- Área
- api, authentication, backend
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 32/100