microsoftgraph / microsoftgraph/msgraph-sdk-java
Adding more than 1 scope to GraphServicesClient causes an error when using the client
オープン
まだ誰も着手していません。
status:waiting-for-triage
type:bug
- 主要言語
- Java
- スター
- 444
- フォーク
- 154
- 平均マージ
- 18時間 28分
- マージ済み PR(30日)
- 4
説明
Describe the bug
If I true to use more than 1 scope when creating a client new GraphServicesClient(myCredential, scope1, scope2)
an error is encountered when trying to use it:
Exception in thread "main" com.azure.identity.CredentialUnavailableException: To convert to a resource string the specified array must be exactly length 1
at com.azure.identity.AzureCliCredential.getTokenSync(AzureCliCredential.java:103)
at com.azure.identity.ChainedTokenCredential.getTokenSync(ChainedTokenCredential.java:134)
at com.microsoft.kiota.authentication.AzureIdentityAccessTokenProvider.getAuthorizationToken(AzureIdentityAccessTokenProvider.java:167)
at com.microsoft.kiota.authentication.BaseBearerTokenAuthenticationProvider.authenticateRequest(BaseBearerTokenAuthenticationProvider.java:46)
at com.microsoft.kiota.http.OkHttpRequestAdapter.getHttpResponseMessage(OkHttpRequestAdapter.java:710)
at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:275)
...redacted...
Caused by: java.lang.IllegalArgumentException: To convert to a resource string the specified array must be exactly length 1
at com.azure.identity.implementation.util.ScopeUtil.scopesToResource(ScopeUtil.java:27)
at com.azure.identity.implementation.IdentitySyncClient.authenticateWithAzureCli(IdentitySyncClient.java:375)
at com.azure.identity.AzureCliCredential.getTokenSync(AzureCliCredential.java:97)
... 11 more
Expected behavior
To allow more than 1 scope.
How to reproduce
Add more than 1 scope to the constructor.
SDK Version
6.x
Latest version known to work for scenario above?
No response
Known Workarounds
None
Debug output
Click to expand log
```</details>
### Configuration
_No response_
### Other information
_No response_
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
GraphServicesClient コンストラクターから始め、どのようにその scopes が AzureIdentityAccessTokenProvider と、stack trace に示されている Azure identity credential に到達するのかを追跡します。2 つの scopes を使ってクライアントを再現し、それを使用しても ScopeUtil resource-string エラーが発生しなくなっていることと、単一の scope の動作が引き続き維持されていることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- azure, java
- 領域
- api, authentication
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100