microsoftgraph / microsoftgraph/msgraph-sdk-java
Can not make request after migrating to V6 from V5
還沒有人認領這個 Issue。
- 主要語言
- Java
- 星號
- 444
- 分支
- 154
- 平均合併
- 18 小時 28 分鐘
- 30 天內合併 PR
- 4
描述
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();
}
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從已回報的 users.get() 呼叫,以及 AzureIdentityAccessTokenProvider 和 OkHttpRequestAdapter 中的 stack trace 進入點開始。檢查與 TokenRequestContext.setCaeEnabled(boolean) 相關的已解析 Azure Core 和 Microsoft Graph/Kiota 相依版本,然後使用所示的 GraphConfiguration 重現該要求。遷移後的用戶端能夠在不出現所回報的 NoSuchMethodError 的情況下發出 Azure B2C 要求時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- azure, java
- 領域
- api, authentication, backend
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 32/100