Outlook Desktop hangs on autoevent onMessageComposeHandler when OfficeRuntime.auth.getAccessToken is called

Marco Wassink 0 Reputation points
We have an Outlook web-addin that has the onMessageComposeHandler  associated in the manifest.

A couple of times a day the addin hangs while retrieving an accesstoken. It does not crash, but it just hangs, so we are not able to redirect the user to login or something else.

Most of the day it works. We experienced this sometimes while developing, but now our client is also experiencing this.

Here is a piece of the code:

async function onMessageComposeHandler(event) { 

    mailboxItem = Office.context.mailbox.item; 


    try { 

        log("Loading user..."); 

        const accessToken = await OfficeRuntime.auth.getAccessToken({forceConsent: false})
A family of Microsoft email and calendar products.
2,208 questions
JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
756 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Marco Wassink 0 Reputation points

    solved: it was not the getAccessToken that was hanging.

    we removed the async from the onMessageComposeHandler and replaced the await OfficeRuntime.auth.getAccessToken by OfficeRuntime.auth.getAccessToken.then() and it started working flawless again

    0 comments No comments