Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding more than 1 scope to GraphServicesClient causes an error when using the client #2294

Open
aappddeevv opened this issue Feb 8, 2025 · 0 comments
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience

Comments

@aappddeevv
Copy link

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_
@aappddeevv aappddeevv added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience
Projects
None yet
Development

No branches or pull requests

1 participant