Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
wmmihaa
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
New Member

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));
}

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.