-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OfficeRuntime.auth.getAccessToken fails after a period of inactivity #5260
Comments
Here are some similar issues that might help you. Please check if they can solve your problem.
Possible solution (Extracted from existing issue, might be incorrect; please verify carefully) Solution 1:Ensure that the add-in id has been added to the list of authorized applications. The id needs to be pre-authorized. Refer to the doc: https://learn.microsoft.com/en-us/office/dev/add-ins/develop/register-sso-add-in-aad-v2 Reference: Solution 2:We had the same problem after the last Outlook Desktop update. When we added the Client Id from the error message as a pre-authorized client in the App registration (Expose an API) it worked again. Reference: |
The similar issues are older than our new issue and they are not relevant to our problem. |
Hi @ragnarstolsmark , thanks for reporting and sharing the details. Could you please help us with below information to investigate it further:
|
Here is our code that gets the accessToken: async function getAccessTokenOfficeRuntime(): Promise<string> {
// The getAccessToken api mutates the passed in object. So we have to destructure it every time we use it
const parameters = {
allowConsentPrompt: false,
allowSignInPrompt: !isInEventContext(), //isInEventContext() returns true when the code is triggered by an outlook add-in event.
};
try {
const accessToken = await OfficeRuntime.auth.getAccessToken({ ...parameters });
return accessToken;
} catch (error) {
if (!shouldRetry(error)) {
throw error;
}
}
return new Promise((resolve, reject) => {
setTimeout(() => {
OfficeRuntime.auth
.getAccessToken({ ...parameters })
.then(resolve)
.catch(reject);
}, 300);
}); We do not have a sample addin where the issue is reproducible. The scenario is observed by our users who use our outlook add-in for inserting signatures into their e-mails. It seems to appear more often when the user has been inactive for some time, maybe it has something to do with a token that has expired? |
Provide required information needed to triage your issue
Your Environment
Expected behavior
I expected the OfficeRuntime.auth.getAccessToken to return an access token. It has worked well until late december 2024 (approx. 26 december)
Current behavior
It returns error code 13006.
Steps to reproduce
Provide additional details
We handle error 13006 by using an MSAL popup. Subsequent calls to getAccessToken do not fail after the popup has successfully authenticated the user.
Context
The issue is degrading the user experience of customers using our Outlook add-in. It only affects Outlook online.
Useful logs
Screenshot of our application insights showing the trend for error code 13006.
The text was updated successfully, but these errors were encountered: