How to Refresh an Expired Office Add-in Access Token
Question details
The user needs to refresh an expired authentication token for an Office add-in to restore its functionality.

- Product
- Microsoft Office
- Device & OS
- not provided
- Scenario
- Developing or running an Office add-in that relies on the OfficeRuntime.auth.getAccessToken API for user authentication.
- Observed behavior
- The Office add-in stops working after approximately 87 minutes because the access token expires.
Verify that your add-in code correctly handles the OfficeRuntime.auth.getAccessToken method and check your Azure App registration settings before debugging token lifespans.
Consult Microsoft Q&A Office Development Specialists
Since token refresh behavior involves deep Microsoft Office JavaScript API integration and Azure AD configurations, the best route is consulting Microsoft development specialists.
The OfficeRuntime.auth.getAccessToken API usually returns a token valid for about 87 minutes. Implementing a robust refresh token flow typically requires handling the expiration on your backend or prompting the user to re-authenticate seamlessly.
Open your web browser and go to the official Microsoft Q&A website.
Filter the platform tags or search directly for the 'Office Development' section, which handles JavaScript API issues.
Create a new thread detailing your add-in's authentication flow, the 87-minute expiration issue, and provide any relevant code snippets using OfficeRuntime.auth.getAccessToken.

Try WPS Office for a Seamless Document Workflow
If you are tired of complex Microsoft Office configurations and add-in deployment issues, consider switching to WPS Office. It provides a free, lightweight, and highly compatible alternative that simplifies your daily tasks without the overhead.
- 1. Download WPS Office: Visit the official WPS Office website and click the free download button for your operating system.
- 2. Install the Software: Run the downloaded installer and follow the simple on-screen instructions to complete the setup.
- 3. Open Your Documents: Launch WPS Office and instantly open your existing Word, Excel, or PowerPoint files with perfect formatting compatibility.

Frequently Asked Questions
Why does the OfficeRuntime.auth.getAccessToken token expire after 87 minutes?
By default, access tokens issued by Azure Active Directory for Office add-ins have a lifespan of approximately 60 to 90 minutes (often exactly 87 minutes) for security reasons. Once the token expires, a new one must be acquired to maintain access to secured resources.
Can I automatically refresh the token within my Office add-in?
Yes, typically your web application backend handles token refreshing using a refresh token, or your client-side JavaScript can catch the 13006 error (token expiration) and silently call the getAccessToken method again to prompt the issuance of a new token.
Where can I find sample code for handling Office add-in token expiration?
Microsoft provides extensive documentation and sample repositories on GitHub, particularly under the OfficeDev accounts, detailing Single Sign-On (SSO) and token management best practices.
Does WPS Office support Microsoft Office add-ins?
WPS Office supports many standard COM and VSTO add-ins, but web-based Office JavaScript API add-ins (like those using OfficeRuntime.auth) have different architectures and may require adjustments or different compatibility layers.




