Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

Dynamics Web API - Refresh Token

$
0
0

I am using the Dynamics Web API and Microsoft.IdentifyModel.Clients.ActiveDirectory package to connect to Dynamics from an Azure Function (.NET Core) app.

My connection is pretty standard,

        var clientCred = new ClientCredential(AppClientId, AppClientSecret);

            result = await _context.AcquireTokenAsync(DynamicsTenantUrl, clientCred);
            Token = result.AccessToken;

However, the application I have built this connection for has a long-running operation that eventually gets a "Not Authorized" back from Dynamics because the token has expired.

I have looked around at a couple of examples where I need to get the refresh_token back in order to then request that piece of information to keep the connection going, however the above does not give me a refresh token.

I have tried doing the AcquireTokenSilentAsync method and even though it shows a token in the TokenCache it always returns "No token available."

Is there a way to do this with the current implementation or do I need to change my connection code completely to access this token?


Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>