Why Do OAuth-Based Data sources Expire on Power BI Gateway and What You Can Do About It
You have built a beautiful Power BI report, published it, and configured your on-premises data gateway. Everything works perfectly until a few days or weeks later, you see this annoying message:
"Your data source credentials have expired. Please reauthenticate."
Frustrating? Absolutely. Preventable? Mostly, yes.
Let us break down what is really happening behind the scenes and how you can design your Power BI environment to avoid this common OAuth expiry problem.
The OAuth Expiry Problem in Power BI Gateway
OAuth is great for secure, token-based cloud authentication. But there is a catch - tokens expire:
Access tokens are valid for around 60 to 90 minutes.
Refresh tokens last a few days to weeks but depend heavily on tenant policies.
When Power BI Service connects through an on-premises Gateway, token behavior differs from standard cloud connectors. This causes many to face sudden credential expiry errors.
Token Storage and Expiry Nuances
Power BI stores tokens securely, but cloud services like Azure AD or Salesforce may invalidate tokens if:
They are not used frequently.
New consent is required by organisational policy.
The user changes their password or becomes inactive.
Enterprise Tenant Policies and Consent Rules
OAuth expiration is not a bug - it is a security feature. Enterprises often enforce token expiry every 14, 30, or 90 days depending on their security needs.
OAuth Is Always User-Bound
Most OAuth implementations in Power BI tie tokens to individual user accounts. So, if that user:
Is disabled,
Goes on leave, or
Changes their password,
the token stops working, triggering the dreaded "Please reauthenticate" message.
OAuth Behavior in Power BI Desktop - What Developers Often Miss
Many Power BI developers work mainly in Power BI Desktop and are confused when:
They authenticate once in Desktop,
The report works fine locally,
But after publishing, it suddenly asks for credentials again.
Here is why:
OAuth tokens in Desktop live only for the current session or limited time.
When the token expires, Desktop will prompt again for login.
Power BI Service and Gateway manage tokens differently, so token expiry in Service can break refreshes even if Desktop works fine.
Why Do Developers Complain About OAuth in Power BI?
Common complaints are:
"Why does my published report break when my Desktop version works?"
"Why do I keep getting asked to login again and again?"
"Why does the Gateway ask for credentials even though I logged in before?"
The answer is token expiry and user-bound OAuth tokens combined with differences in token management between Desktop, Service, and Gateway.
Best Practices for Power BI Developers to Avoid OAuth Frustrations
Use Service Principals for supported sources
Authenticate using Service Principals instead of personal user accounts whenever possible. This avoids token expiry due to user changes.Clear cached credentials in Desktop when facing errors
Go to File > Options > Data Source Settings and clear cached OAuth tokens to force a fresh login.Test dataset refresh in Power BI Service before publishing widely
Catch OAuth or consent issues early by validating refresh success in Service.Use dedicated service users for OAuth connections without SPNs
Create dedicated user accounts with minimal permissions and no MFA. Avoid using personal accounts to reduce risk.Educate your team on OAuth expiry and security policies
Understand that token expiry is by design, not a bug. Prepare for reauthentication cycles as part of security hygiene.
Starburst Connector - Same Story, New Names
The Starburst Enterprise connector is now renamed simply as the Starburst connector, with a new Starburst secured by Entra ID connector also available.
Even Starburst faces OAuth expiry issues. It offers two connection modes in Power BI:
OAuth-based connector (recommended)
Username/Password basic authentication
If you use the OAuth connector via Gateway, you will see expiry problems such as:
"Your OAuth2 credentials are invalid."
This happens if:
The user configured is inactive,
Tokens were not refreshed, or
Tenant policies require new consent.
This is not a Starburst-specific bug. It is just how OAuth behaves inside Power BI Gateway.
What Can You Actually Do?
Here are practical solutions to manage OAuth expiry:
Use Service Principals where possible
For Azure-based sources like SharePoint and Azure SQL, configure App Registrations with Client Secrets or Certificates. Service Principals do not expire like user tokens, are not tied to individuals, and offer more stable refreshes.Use dedicated service accounts for OAuth sources without SPNs
For platforms like Salesforce or Starburst where SPNs are not supported, create dedicated user accounts, turn off MFA for these accounts, and give minimal required permissions only.Avoid Gateway for cloud-to-cloud OAuth sources when possible
Skip Gateway and connect directly via cloud connectors such as SharePoint Online, Dynamics 365, and Starburst Cloud. This avoids Gateway token expiry problems.Monitor token expiry proactively
Set alerts or dashboards to track credential expiry using PowerShell, Admin APIs, or Power BI reports.Use long-lived tokens where possible
Some platforms like Snowflake and GitHub provide personal access tokens or API keys that last longer. Explore these if your organisation policy allows.
Final Thoughts
OAuth token expiry is here to stay because it is part of strong security practices. But you can:
Architect your environment to reduce disruptions.
Use Service Principals for reliable access.
Prefer cloud-native connectors to avoid Gateway pitfalls.
Manage Starburst and other connectors smartly with dedicated accounts.