Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Unanswered

Dynamics 365 CRM Android Java-Kotlin Integration

Posted on by Microsoft Employee

To call a dynamimcs CRM web API on a android device programmatically
Steps 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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 CRM Android Java-Kotlin Integration

    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.

  • kojisaiki Profile Picture
    kojisaiki on at
    RE: Dynamics 365 CRM Android Java-Kotlin Integration

    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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 CRM Android Java-Kotlin Integration

    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.

  • kojisaiki Profile Picture
    kojisaiki on at
    RE: Dynamics 365 CRM Android Java-Kotlin Integration

    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.

    pastedimage1587518717649v2.png

    # you can try postman with this docs: https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/webapi/use-postman-web-api

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 CRM Android Java-Kotlin Integration

    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.

  • kojisaiki Profile Picture
    kojisaiki on at
    RE: Dynamics 365 CRM Android Java-Kotlin Integration

    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

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.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans