You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried following the setup tutorial, picking the InteractiveBrowserCredential, but running everything on Android. Yet, the browser does not work and this code makes the app crash
new Thread(()->{
final InteractiveBrowserCredential credential = new InteractiveBrowserCredentialBuilder()
.clientId(CLIENT_ID)
.tenantId(TENANT_ID)
.redirectUrl("http://localhost")
.build();
if (null == scopes || null == credential) {
print("Unexpected error");
}
// final AzureIdentityAuthenticationProvider authenticationProvider =
// new AzureIdentityAuthenticationProvider(credential, null, scopes);
//
// mClient = new GraphServiceClient(authenticationProvider);
mClient = new GraphServiceClient(credential, scopes);
print(mClient.me().get().getAboutMe());
}).start();
StackTrace
The error seems to relate to the HttpClient:
com.azure.core.exception.ClientAuthenticationException: Failed to acquire token with Interactive Browser Authentication.
at com.azure.identity.implementation.IdentitySyncClient.authenticateWithBrowserInteraction(IdentitySyncClient.java:336)
at com.azure.identity.InteractiveBrowserCredential.getTokenSync(InteractiveBrowserCredential.java:174)
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:711)
at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:276)
at com.microsoft.graph.users.item.UserItemRequestBuilder.get(UserItemRequestBuilder.java:761)
at com.microsoft.graph.users.item.UserItemRequestBuilder.get(UserItemRequestBuilder.java:747)
...
Caused by: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/sun/net/httpserver/HttpHandler;
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:372)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2049)
at com.azure.identity.implementation.IdentitySyncClient.authenticateWithBrowserInteraction(IdentitySyncClient.java:334)
at com.azure.identity.InteractiveBrowserCredential.getTokenSync(InteractiveBrowserCredential.java:174)
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:711)
at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:276)
at com.microsoft.graph.users.item.UserItemRequestBuilder.get(UserItemRequestBuilder.java:761)
at com.microsoft.graph.users.item.UserItemRequestBuilder.get(UserItemRequestBuilder.java:747)
at
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/sun/net/httpserver/HttpHandler;
at com.microsoft.aad.msal4j.AbstractClientApplicationBase.getAuthenticationResultSupplier(AbstractClientApplicationBase.java:146)
at com.microsoft.aad.msal4j.AbstractClientApplicationBase.executeRequest(AbstractClientApplicationBase.java:118)
at com.microsoft.aad.msal4j.PublicClientApplication.acquireToken(PublicClientApplication.java:130)
at com.azure.identity.implementation.IdentitySyncClient.authenticateWithBrowserInteraction(IdentitySyncClient.java:334)
at com.azure.identity.InteractiveBrowserCredential.getTokenSync(InteractiveBrowserCredential.java:174)
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:711)
at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:276)
at com.microsoft.graph.users.item.UserItemRequestBuilder.get(UserItemRequestBuilder.java:761)
at com.microsoft.graph.users.item.UserItemRequestBuilder.get(UserItemRequestBuilder.java:747)
at
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.sun.net.httpserver.HttpHandler" on path: DexPathList[[dex file com.microsoft.aad.msal4j.AbstractClientApplicationBase.getAuthenticationResultSupplier(AbstractClientApplicationBase.java:146)
at com.microsoft.aad.msal4j.AbstractClientApplicationBase.executeRequest(AbstractClientApplicationBase.java:118)
at com.microsoft.aad.msal4j.PublicClientApplication.acquireToken(PublicClientApplication.java:130)
at com.azure.identity.implementation.IdentitySyncClient.authenticateWithBrowserInteraction(IdentitySyncClient.java:334)
at com.azure.identity.InteractiveBrowserCredential.getTokenSync(InteractiveBrowserCredential.java:174)
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:711)
at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:276)
at com.microsoft.graph.users.item.UserItemRequestBuilder.get(UserItemRequestBuilder.java:761)
at com.microsoft.graph.users.item.UserItemRequestBuilder.get(UserItemRequestBuilder.java:747)
at
What I tried
adding useLibrary 'org.apache.http.legacy' to my gradle.build file
adding <uses-library android:name="org.apache.http.legacy" android:required="true" /> to the AndroidManifest.xml file
It simply doesn't work.
Expected behavior
I tried it on my desktop, using a minimalist Java app and pasting the code in public static void main() and got the following behavior:
browser opens at login page
after login, page reads "you can close this window"
then the System.out actually prints the user's info.
Unfortunately, the Azure SDK for Android doesn't have a production identity package that would provide the right TokenCredential objects that you would easily pass to the GraphServiceClient & the Azure Identity Java SDK doesn't support Android. We would need to update the sample with some hacks to get this working. Please bear with us on this.
Describe the bug
Description
I tried following the setup tutorial, picking the InteractiveBrowserCredential, but running everything on Android. Yet, the browser does not work and this code makes the app crash
StackTrace
The error seems to relate to the HttpClient:
What I tried
useLibrary 'org.apache.http.legacy'
to mygradle.build
file<uses-library android:name="org.apache.http.legacy" android:required="true" />
to theAndroidManifest.xml
fileIt simply doesn't work.
Expected behavior
I tried it on my desktop, using a minimalist Java app and pasting the code in
public static void main()
and got the following behavior:I expected the same on Android.
How to reproduce
copy paste the code above.
SDK Version
6.16.0
Latest version known to work for scenario above?
No response
Known Workarounds
Well, giving up on the
msgraph-sdk-java
, using the code generated on entra.microsoft.com for signing in and making my own GraphHelper class to send raw API calls rather than using the SDKDebug output
Click to expand log
```The text was updated successfully, but these errors were encountered: