microsoftgraph / microsoftgraph/msgraph-sdk-java

Can not make request after migrating to V6 from V5

オープン
#2,236 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Needs: Attention :wave: type:question
主要言語
Java
スター
444
フォーク
154
平均マージ
18時間 28分
マージ済み PR(30日)
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();
    }

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

報告されている users.get() 呼び出しと、AzureIdentityAccessTokenProvider および OkHttpRequestAdapter におけるスタックトレースのエントリーポイントから始めます。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

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。