Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

API Integration with D365FO: Can I Get Access Token with MFA enabled on ADFS?

(1) ShareShare
ReportReport
Posted on by 905
Hi dears !
I have a .NET application that is integrated with D365FO through SOAP/REST APIs.
I was able to successfully integrate with D365 FO on-prem no problem through a REST getToken API with ADFS.
But there is one environment that I'm unable to integrate with, recieving /invalid_grant/ error from the getToken API.
This environment has MFA (Multi-Factor Authentication) enabled on their ADFS. I asked them to disable MFA to test the API and it worked.
Is it possible to get the access token with MFA enabled? or the only solution is to exclude the integration user from the MFA policy?
 
in the get token API call, we are providing the following parameters:
- resource= https://url.example/namespaces/AXSF
- client_id= 111-1111-111-111 (example)
- client_secret=1111111111 (example)
- Tenant = https://url.example/adfs
- grant_type = client_credentials
 
Any advice is appreciated !
Thanks in advance !
  • Momochi Profile Picture
    Momochi 905 on at
    API Integration with D365FO: Can I Get Access Token with MFA enabled on ADFS?
     
    Here is the screenshot for the error I receive in the get token API in postman while MFA is enabled:
    And once we disable MFA, the access token is received without any issue.
    I thought of excluding the integration users from MFA policy, but the IT team are being strict and asking me if there are other solutions... 
  • Suggested answer
    Kevin Xia Profile Picture
    Kevin Xia Microsoft Employee on at
    API Integration with D365FO: Can I Get Access Token with MFA enabled on ADFS?
    Hi,
    Can you share a screenshot of the error or the full error message? You can think about excluding specific integration users from the MFA policy first and then look for other solutions, or you can consider using the OAuth 2.0 authorization code flow. You can refer to this blog: https://impulztech.com/dynamics-365-finance-and-operations-acquire-access-token-using-oauth-2-0/This blog discusses how to obtain access token in Dynamics 365 Finance and Operations to enable data access of another application via APIs that use OAuth 2.0 authorization protocol.
    Best regards,
    Kevin

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…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,817 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans