microsoftgraph / microsoftgraph/msgraph-sdk-java
Adding more than 1 scope to GraphServicesClient causes an error when using the client
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
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_
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 le constructeur de GraphServicesClient et suivez le cheminement de ses scopes jusqu’à AzureIdentityAccessTokenProvider et à l’identifiant d’identité Azure affiché dans la stack trace. Reproduisez le client avec deux scopes, puis vérifiez que son utilisation ne lève plus l’erreur de resource-string de ScopeUtil et que le comportement avec un seul scope reste intact.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- azure, java
- Domaine
- api, authentication
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100