Forum Discussion
Expiration information about AccessToken generated with PowerBI Rest API
Hello,
We are developping an Delphi winform application which is reading powerBI report in TWebBrowser.
To call reports, we are reading AccessToken in an INI file previously generated with the ClientID created here : https://dev.powerbi.com/apps
The AccessToken is generated with a C# console application with this code :(because we did not find any other solution to generated it in Delphi)
string redirectUri = "https://login.live.com/oauth20_desktop.srf"; string resourceUri = "https://analysis.windows.net/powerbi/api"; string authorityUri = "https://login.windows.net/common/oauth2/authorize"; AuthenticationContext authContext = new AuthenticationContext(authorityUri); string token = authContext.AcquireToken(resourceUri, clientID, new Uri(redirectUri)).AccessToken;
When the user is running our application, he have to login with his powerBI account but we don't understand how many time the AcessToken is valid. Is there an expiration ? How can we set it ?
Thank you for your help.
Normally the token expires in one hour. You can decode the token and find an "exp" field in the decoded JSON.
As to how to extend the expire duration, it is a more Azure AD question. I think you'll get more proper response from the dedicated Azure AD forum.
1 Reply
- Eric_ZhangMicrosoft Employee
Normally the token expires in one hour. You can decode the token and find an "exp" field in the decoded JSON.
As to how to extend the expire duration, it is a more Azure AD question. I think you'll get more proper response from the dedicated Azure AD forum.