In my Anroid Java app, I would like to offer users the option of searching for and downloading their files from Onedrive.
I use the Android Java example from official documentation.
The example works, I receive the access token.
It’s not clear to me what happens next.
I can’t find in the documentation how to pass the access token to the GraphServiceClient or the AuthProvider.
Creating the GraphServiceClient Object:
final InteractiveBrowserCredential interactiveBrowserCredential = new InteractiveBrowserCredentialBuilder()
.clientId(CLIENT_ID)
.redirectUrl(REDIRECT_URL)
.build();
final TokenCredentialAuthProvider authProvider = new TokenCredentialAuthProvider(SCOPES, interactiveBrowserCredential);
final GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider(authProvider).buildClient();
buidling DriveItem:
DriveItem rootItem = graphClient
.me()
.drive()
.root()
.buildRequest()
.get();
causes to this Exception:
ExecutionException: com.azure.core.exception.ClientAuthenticationException: Failed to acquire token with Interactive Browser Authentication.
implementation 'com.microsoft.identity.client:msal:5.1.0'
implementation 'com.microsoft.graph:microsoft-graph:5.77.0'
implementation 'com.microsoft.graph:microsoft-graph-core:2.0.21'
implementation 'com.azure:azure-identity:1.11.0'
I’m in a bit of a pickle now.
Can someone please help me, thank you
GGK
1