2
votes

I am working on Power BI reports and integrating it into an app using sample code provided by Microsoft in Github. Client ID and the secret key should be copied into config file after registering the app in Azure Active Directory. I am able to get the access token using the dashboard sample where the user needs to log in and generate embed URL. Does anyone know how to refresh the token or extend the expire time as for now, it has only 1 hour after that report doesn't work?

Thanks.

1

1 Answers

1
votes

You can refresh the access_token by submitting POST request to the /token endpoint With grant_type=refresh_token , please click here for how to refresh token in OAuth 2.0 auth code grant .

With ADAL 2.X version , you could use AuthenticationContext.AcquireTokenByRefreshToken function to acquire a security token from the authority using a Refresh Token previously received .

But with ADAL 3.X version, it won't expose refresh token and AuthenticationContext.AcquireTokenByRefreshToken function has been removed . ADAL caches refresh token and will automagically use it whenever you call AcquireToken and the requested token need renewing(even you want to get new access token for different resource). More background at http://www.cloudidentity.com/blog/2015/08/13/adal-3-didnt-return-refresh-tokens-for-5-months-and-nobody-noticed/

To extend the expire time of access token , you could refer to document :Configurable token lifetimes in Azure Active Directory