To call a dynamimcs CRM web API on a android device programmaticallySteps to reproduce:
1. https://github.com/Azure-Samples/ms-identity-android-java
OR
1. https://github.com/Azure-Samples/ms-identity-android-kotlin
2. Replace the MS Graph API to Dynamics CRM web API
Sample D365 CRM web API : https://organization.crm5.dynamics.com/api/data/v9.1/WhoAmI
Current Scenario/Issue/Result : 401 Unathorized
Reference to Microsoft Docs: 1. https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-v2-android
Can you try ADAL library for java named "ADAL4J"?https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/authenticate-oauth#use-adal-libraries-to-connect
Thanks for the input.
All versions are ADAL are deprecated, and MSAL is now in use.
No versions of MSAL have access to call any API other than Microsoft Graph API.
I want to integrate other Microsoft Web APIs using the access token of MSAL and integrate a Android mobile app (not a Web app)
Could try some integrating the above mentioned links.
I have tried to request via Postman. Posted http headers on the request below.
Can you try plane http request on java (like HttpUrlConnection) with below headers ? I suppose to Authorization header is the point.
# you can try postman with this docs: https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/webapi/use-postman-web-api
I have also followed the Postman way and it works for desktop client.
The headers are those as mentioned in the docs.
But the API does not work on a mobile client.
If the actual http request from Android app and the request from Postman are completely same, both requests should be succeeded.
1) Is any request to other service web api or internet access from the Android app succeeded?
2) If you use a token string that same with Postman request in "Authorization" header, is it succeeded? (use literal string instead of programmatically authorization)
3) Try to capture actual http request from Android app and compare with postman request. I suppose to you can capture with Fiddler https://www.telerik.com/blogs/how-to-capture-android-traffic-with-fiddler
Both the requests are not completely same but are similar
Ans 1. Yes, The API integration of MS Graph API is successful
Ans 2. Yes, The access token token generated from AuthenticationResult is added to API using Volley.
Ok, I will try to capture fiddler traces and compare.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Rishabh Kanaskar 235
MVP-Daniyal Khaleel 175
Tom_Gioielli 156 Super User 2025 Season 2