You might have seen this message on the User card which says the Web Service Access key is being deprecated on Saas.
Please follow the below steps to generate OAuth for API.
- login to Azure portal https://portal.azure.com/ with ADMIN rights
- 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![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2u5sGM11231OO5Ufg_VwZ8Mj9QQe3ah7ujaQ4IIKYHwunQIEK-ke9hs8-s7eFKJJHqo-WCZhPaKG7-uH8CMR5bGFvxhNlf8XtS8MDPK2Qc3X9UQMi6mnE1zVRmDBZXXAmb8dMJOOl9IY/w528-h168/image.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2u5sGM11231OO5Ufg_VwZ8Mj9QQe3ah7ujaQ4IIKYHwunQIEK-ke9hs8-s7eFKJJHqo-WCZhPaKG7-uH8CMR5bGFvxhNlf8XtS8MDPK2Qc3X9UQMi6mnE1zVRmDBZXXAmb8dMJOOl9IY/w528-h168/image.png)
15. Give some Token name BCAPP,
Call back URL = https://businesscentral.dynamics.com
Auth URL = https://login.windows.net/<tanant ID here>/oauth2/authorize?resource=https://api.businesscentral.dynamics.com
Looks like step #15 is changed so try this URL: Auth URL : https://login.microsoftonline.com/a34f8ecc-bb42-4bcf-b12a-798d0109d2af/oauth2/authorize?resource=https://api.businesscentral.dynamics.com
Access Token URL = https://login.windows.net/<Tenant ID here>/oauth2/authorize?resource=https://api.businesscentral.dynamics.com
Try Access Token URL =https://login.microsoftonline.com/a34f8ecc-bb42-4bcf-b12a-798d0109d2af/oauth2/token?resource=https://api.businesscentral.dynamics.com
Client ID = Generated From previous steps
Client Secret value = Generated From previous steps
Select Add Authorization data to = Requests headers
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
How long is the access token alive for, after a oauth login?
ReplyDeleteHey Thanks for your question. I noticed that access token is alive for some time ( untill you are active in Postman). I had to generate the token again after some time, but I am also trying to find the exact answer.
Delete