microsoftgraph / microsoftgraph/msgraph-sdk-java
Can not make request after migrating to V6 from V5
Personne n'a encore pris cette issue.
- Langage dominant
- Java
- Étoiles
- 444
- Forks
- 154
- Merge moyen
- 18 h 28 min
- PR mergées (30 j)
- 4
Description
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();
}
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par l’appel users.get() signalé et les points d’entrée de la stack trace dans AzureIdentityAccessTokenProvider et OkHttpRequestAdapter. Examinez les versions résolues des dépendances Azure Core et Microsoft Graph/Kiota autour de TokenRequestContext.setCaeEnabled(boolean), puis reproduisez la requête avec la GraphConfiguration indiquée. Le travail est terminé lorsque le client migré peut effectuer la requête Azure B2C sans le NoSuchMethodError signalé.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- azure, java
- Domaine
- api, authentication, backend
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 32/100