I am using OData api of MS Dynamics. Here we are doing authentication using oauth
I am taking reference from Ref : https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/developer-guide?view=dynamics-ce-odata-9
I am using Web Api so we followed below reference.
Steps we have follow :
1. Registered an app to Microsoft Azure:
2. Acquire token using ADAL.js. - Tried with ADAL C# sdk but it gets failed as dialog for login window could not pop out into Asp.Net Core Web Api project.
To Generate token we are only using ApplicationId , ResourceUrl (dynamics resource url).
3. Pass as Bearer token to the rest api’s . It worked.
Need : We have to refresh token, if the token get expired. We tried using c# ADAL SDK that is specified into the document itself.
AuthenticationContext authContext =
new AuthenticationContext("https://login.windows.net/common/", false);
AuthenticationResult result = await authContext.AcquireTokenAsync(resource, clientId, new Uri(redirectUrl), new PlatformParameters());
Exception : The method or operation is not implemented.
at Microsoft.IdentityModel.Clients.ActiveDirectory.Internal.Platform.WebUIFactory.CreateAuthenticationDialog(IPlatformParameters parameters)
Can you guide us, how can we refresh token in Web Api (Asp.net Core). And how can we get refresh_token in MS Dynamics OAuth. Do you have any other approach to access token / refresh token?
Note : We only allow login oauth dialog box from html page once and store the given token. We have to use either same token to generate new token or any other way to refresh token(without prompt dialog second time) to be use in MS Dynamics OData Web Api. I am using Asp.net Core Web API Project to perform interaction between dynamics.