microsoftgraph / microsoftgraph/msgraph-sdk-java
Adding more than 1 scope to GraphServicesClient causes an error when using the client
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Java
- Estrellas
- 444
- Forks
- 154
- Merge medio
- 18 h 28 min
- PR fusionados (30 d)
- 4
Descripción
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_
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el constructor de GraphServicesClient y sigue cómo sus scopes llegan a AzureIdentityAccessTokenProvider y a la credencial de identidad de Azure que se muestra en el stack trace. Reproduce el cliente con dos scopes y verifica que su uso ya no genere el error de resource-string de ScopeUtil y que el comportamiento con un solo scope permanezca intacto.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- azure, java
- Área
- api, authentication
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100