Hi Everyone,
I'm currently trying to integrate with Dynamics 365 Business Central use Web API in .NET Framework. However I got an "Unauthorized" error at last.
First I followed the document "developer.microsoft.com/.../auth_register_app_v2" to get the "access-token"
I have set up the "Application Secrets" and "Add a Platforms".
Then, I went on "https://developer.microsoft.com/en-us/graph/docs/concepts/auth_v2_user" to get the access token. First, by sending
"login.microsoftonline.com/.../authorize
client_id=4b99370f-72ec-4347-8777-eb6faa9bb52c
&response_type=code
&scope=offline_access%20user.read%20mail.read"
I could get the code at redirectURL "http://localhost:8080/?code=OAQABAAIAAADX8GCi6Js6SK82TsD2Pb7rbbl5akjBsGP0CW4qNgqzchj_... ...A4YU1p5zYyzCAzniMPyfLFhlqxckmWByIHnq3Zs9vyZpHOaI64puPSavTzz39tlhCWNORMjIAA&session_state=74f69e17-7d57-49b4-b40d-699a47cd7351"
Then I use send a POST request to get the "access_token" and "refresh_token".
Then I tried to use this access_token to authenticate the API using common endpoint https://api.businesscentral.dynamics.com/v1.0/api/beta. But it failed and return an Unauthorized message.
I could only connect to Dynamic 365 via basic authentication.
I don't know how to use AAD to do the authentication and connect to Dynamic 365 Business Central via common endpoint. Please help in matter and give me any advice if I have some problem in the preview steps I have provided.
Thanks in advance.
Ruining

Report
All responses (
Answers (