microsoftgraph / microsoftgraph/msgraph-sdk-java
Can not make request after migrating to V6 from V5
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 444
- Fork
- 154
- Merge medio
- 18h 28m
- PR unite (30g)
- 4
Descrizione
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();
}
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con la chiamata users.get() segnalata e con i punti di ingresso dello stack trace in AzureIdentityAccessTokenProvider e OkHttpRequestAdapter. Esamina le versioni risolte delle dipendenze Azure Core e Microsoft Graph/Kiota relative a TokenRequestContext.setCaeEnabled(boolean), quindi riproduci la richiesta con la GraphConfiguration mostrata. Il lavoro è completato quando il client migrato può effettuare la richiesta Azure B2C senza il NoSuchMethodError segnalato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- azure, java
- Ambito
- api, authentication, backend
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 32/100