web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Sales forum / How to get access toke...
Sales forum

How to get access token (bearer token) using username and password or App password when MFA is enabled.

(0) ShareShare
ReportReport
Posted on by 5

Hello Experts,

I am trying to get Access Tokens and Refresh Tokens from Azure Active Directory by following Dynamics 365 Online Authenticate with User Credentials and achieved successfully. Now I have enabled MFA for the user, and when I pass the 'App Password' to get the token, I get the below error


The remote server returned an error: (400) Bad Request.

{"error":"invalid_grant","error_description":"AADSTS50126: Invalid username or password.\r\nTrace ID: 6ba62672-ed0f-47a1-84bf-4aa5fee24b00\r\nCorrelation ID: a1d446b9-438b-4652-be86-1ddd07bbf90d\r\nTimestamp: 2019-08-20 12:29:25Z","error_codes":[50126],"timestamp":"2019-08-20 12:29:25Z","trace_id":"6ba62672-ed0f-47a1-84bf-4aa5fee24b00","correlation_id":"a1d446b9-438b-4652-be86-1ddd07bbf90d","error_uri":"">login.microsoftonline.com/error


I looked around for a solution but didn't get it.

How can I get the tokens when MFA is enabled for user?

Thanks!

I have the same question (0)
  • Kipetcoff Profile Picture
    1,037 on at

    Here is an example how I managed to connect to D365 Rest API. Hope it could help you Article

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Sales

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans