cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
wmmihaa New Member
New Member

How to use the oAuth refresh token to acquire a new token?

Is there anyone who could tell me how to use the refresh token to get a new token. I've read through the AAD documentation on the subject, But all I get is: "AADSTS50012: Invalid client secret is provided."

2 REPLIES 2
joespiff Frequent Visitor
Frequent Visitor

Re: How to use the oAuth refresh token to acquire a new token?

I've had success with this:

using Microsoft.IdentityModel.Clients.ActiveDirectory;

public void Refresh(string authorityUri, string ClientID, string ClientSecret, string RefreshToken)
{
TokenCache TC = new TokenCache();
AuthenticationContext AC = new AuthenticationContext(authorityUri, TC);
ClientCredential cc = new ClientCredential(ClientID, ClientSecret);
AuthenticationResult AR = AC.AcquireTokenByRefreshToken(RefreshToken, cc));
}
joespiff Frequent Visitor
Frequent Visitor

Re: How to use the oAuth refresh token to acquire a new token?

} // my initial post didn't include the final curly bracket.

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)