Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

generate AccessToken by using Azure Active Directory Authentication Library (ADAL) for Java.

(0) ShareShare
ReportReport
Posted on by

Hi there i am new MS dynamics crm using Azure Active Directory Authentication Library (ADAL) for Java, am providing all info but still getting error like 

[Correlation ID: e1d768ca-0fc4-4818-8aff-1e46c1acccb6] Execution of class com.microsoft.aad.adal4j.AcquireTokenCallable failed.

com.microsoft.aad.adal4j.AuthenticationException: {"error_description":"AADSTS70002: The request body must contain the following parameter: 'client_secret or client_assertion'.\r\nTrace ID: f2847e21-a64c-4faa-9811-015951d93700\r\nCorrelation ID: e1d768ca-0fc4-4818-8aff-1e46c1acccb6\r\nTimestamp: 2018-11-07 12:56:02Z","error":"invalid_client"}

My code id like this 

//Azure Application Client ID

finalString CLIENT_ID = "00000000-0000-0000-0000-000000000000";

//CRM URL 

final String RESOURCE = "everlifeai.onmicrosoft.com/";

//O365 credentials for authentication w/o login prompt

final String USERNAME = "xxxxxxxxxx@everlifeai.onmicrosoft.com";

final String PASSWORD = "xxxxxxxxxxxx";

//Azure Directory OAUTH 2.0 AUTHORIZATION ENDPOINT

final String AUTHORITY = "login.microsoftonline.com/common";

7853.method.png

and the error is clearly mentioned that This may happen if there are no active subscriptions for the tenant. Check with your subscription administrator. how can i made active subscriptions for my tenant.

*This post is locked for comments

  • Verified answer
    Radu Chiribelea Profile Picture
    Radu Chiribelea 6,667 on at
    RE: generate AccessToken by using Azure Active Directory Authentication Library (ADAL) for Java.

    Can you try to generate a new ClientCredential Object using the username and password

    ClientCredential _clientCredential = new ClientCredential(_clientId, _appKey);

    get then the AuthenticationResuls by calling authContext.AcquireTokenAsync(_crmOrgUrl, _clientCredential).Result;

    Does it work for you like this?

    Regards,

    Radu

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,401 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans