How to Setup OAuth authentication in Business central for API
Posted On May 30, 2021 by Dynamics Infotech
You might have seen this message on the User card which says the Web Service Access key is being deprecated on Saas. … Continue reading
Please follow the below steps to generate OAuth for API.
1.login to Azure portal https://portal.azure.com/ with ADMIN rights
2.Go to All Services and search for App registrations
3. Click New registrations
4. Give some registration Name, and provide the return URL like
https://businesscentral.dynamics.com
5. Click Register
6. Note down the Application ID
7. Select API Permissions tab
8. Select Business central app from the list
9. Click Add permissions
10. Click on Certificates & Secrets and Click +New client secret
11. Select the option of client secret expiry, I selected 2 years and complete the form.
12. You will get Client Secret Value. Note this value as the Value will be masked later
13. Now, its time to test this in Postman application
14. Open Postman, Select Authorization Type = OAuth2.0, Keep Access Token blank as we will
generate this now
15. Give some Token name BCAPP,
Call back URL = https://businesscentral.dynamics.com
Auth URL = https://login.windows.net/
Access Token URL = https://login.windows.net/
Client ID = Generated From previous steps
Client Secret value = Generated From previous steps
Select Add Authorization data to = Requests headers
16. Click Get New Access Token
17. You will get a pop-up window asking for Business central ID and Password
18. Enter the ADMIN ID and password which you have used in Azure directory in above
steps
19. You should get sucess message. If you get an error message then ensure you have entered
the Client ID and CLient secret correct.
20. You will get Access Token in Postman. Then you can use any API available in Business
central and click SEND to test