Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Error : AADSTS50076 while fetching authentication token of Microsoft Dynamic CRM using "com.microsoft.aad.adal4j" in java

Posted on by Microsoft Employee

I am trying to fetch Authentication token of Microsoft Dynamic CRM using "com.microsoft.aad.adal4j" in java and resulting the following error. My organization URI is "https://palmtreeinfotech6.crm8.dynamics.com"

Error:

com.microsoft.aad.adal4j.AuthenticationException: {"error_description":"AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access '00000007-0000-0000-c000-000000000000'.\r\nTrace ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\r\nCorrelation ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\r\nTimestamp: 2016-12-30 09:36:54Z","error":"interaction_required"}
at com.microsoft.aad.adal4j.AdalTokenRequest.executeOAuthRequestAndProcessResponse(AdalTokenRequest.java:107)
at com.microsoft.aad.adal4j.AuthenticationContext.acquireTokenCommon(AuthenticationContext.java:818)
at com.microsoft.aad.adal4j.AuthenticationContext.access$100(AuthenticationContext.java:66)
at com.microsoft.aad.adal4j.AuthenticationContext$1.call(AuthenticationContext.java:174)
at com.microsoft.aad.adal4j.AuthenticationContext$1.call(AuthenticationContext.java:163)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error : AADSTS50076 while fetching authentication token of Microsoft Dynamic CRM using "com.microsoft.aad.adal4j" in java

    I am using com.microsoft.aad:adal4j:0.0.2

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error : AADSTS50076 while fetching authentication token of Microsoft Dynamic CRM using "com.microsoft.aad.adal4j" in java

    The following code

    >>

    private final static String CLIENT_ID = "xxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx";

    AuthenticationResult result = getAccessTokenFromUserCredentials();

    System.out.println("Access Token - " + result.getAccessToken());

    private static AuthenticationResult getAccessTokenFromUserCredentials() throws Exception {

    AuthenticationContext context = null;

    AuthenticationResult result = null;

    ExecutorService service = null;

    try {

    service = Executors.newFixedThreadPool(1);

    context = new AuthenticationContext(AUTHORITY, false, service);

    Future<AuthenticationResult> future = context.acquireToken(RESOURCE, CLIENT_ID, USERNAME, PASSWORD, null);

    result = future.get();

    } finally {

    service.shutdown();

    }

    if (result == null) {

    throw new ServiceUnavailableException("authentication result was null");

    }

    return result;

    }

    >>

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans