Hello,
We are using the Web API to access our Dynamics 365 Online CRM.
So far we have been manually generating our Access Token, which gives us a one hour access window.
We have been unable to find the correct series of parameters for programmatically generating a new Access Token from our Refresh Token.
Right now we do not want to use the SDK, ADAL or any other library to achieve this. Just a basic web call.
Here is an example of how we achieve this at a different site utilizing OAUTH2 security:
WebRequest request = WebRequest.Create("https://accounts.site.com/oauth/v2/token?client_id=<id>&client_secret=<secret>&grant_type=refresh_token&refresh_token=<refresh token>");
request.Method = "POST";
WebResponse response = request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
AccessToken at = JsonConvert.DeserializeObject<AccessToken>(responseFromServer);
A very simple POST call using ClientID, ClientSecret and RefreshToken to generate a new AccessToken. Exactly what I am looking to do in Dynamics 365 API. But, I cannot find the permutation of parameters that will work in Dynamics to accomplish this.
Has anyone been able to accomplish this with Dynamics 365 Online?
Thanks.
Bryan Hunt
*This post is locked for comments