office-jsoutlook-addinoffice-addinsoutlook-web-addinsoutlook-web-app

Cannot use getAccessTokenAsync on Mobile


I created an Office.js add-in that works fine on OWA and Outlook desktop app. But, on the Outlook app for iOS and Android, I receive this error:

TypeError: Cannot read proerties of undefined (reading 'getAccessTokenAsync')

Can I not use the function Office.context.auth.getAccessTokenAsync if I plan on using the add-in on mobile? If it is allowed, then what can I do to get around this error? I've also tried using Promise.resolve(OfficeRuntime.auth.getAccessToken()), but got this error -

ReferenceError: OfficeRuntime is not defined

Solution

  • getAccessTokenAsync is a part of IdentityAPI 1.3 and is not available for Outlook Mobile yet. You can see the list of supported API sets on Outlook for different platforms here.