microsoftgraph / microsoftgraph/msgraph-sdk-java
Adding more than 1 scope to GraphServicesClient causes an error when using the client
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 444
- Fork
- 154
- Merge medio
- 18h 28m
- PR unite (30g)
- 4
Descrizione
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_
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 dal costruttore di GraphServicesClient e segui come i suoi scopes raggiungono AzureIdentityAccessTokenProvider e la credenziale di identità Azure mostrata nello stack trace. Riproduci il client con due scopes, quindi verifica che il suo utilizzo non generi più l’errore di resource-string di ScopeUtil e che il comportamento con un singolo scope rimanga invariato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- azure, java
- Ambito
- api, authentication
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100