OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
670 stars 96 forks source link

Outlook Add-in : Office.auth.getAccessToken() throws 13001 error in Firefox #4864

Open cedomm opened 1 week ago

cedomm commented 1 week ago

Calls to Office.auth.getAccessToken() throws a 13001 error in Firefox but works fine in Chrome / Edge. It used to work in Firefox too so this must be some regression. In the documentation this error is listed for Safari :

In Outlook on the web, this API isn't supported if you use the Safari browser. This results in error 13001 ("The user is not signed into Office").

source : https://learn.microsoft.com/en-us/javascript/api/office/office.auth?view=common-js-preview#office-office-auth-getaccesstoken-member(1)

Your Environment

Platform: Outlook Web Browser: Firefox The task pane add-in is running in compose mode.

Expected behavior

The access token should be retrieved.

Current behavior

A 13001 error "The user is not signed into Office" is thrown.

cedomm commented 1 week ago

Found the cause of the issue, it only happens if Enhanced tracking protection is enabled, and it is by default :

protection

In the console, we can see that the call to the OAUTH 2.0 authorization endpoint seems discarded as it never gets a response, and toggling the details show no info at all for the request :

authorization_encpoint_call

It is really strange that this feature blocks such a standard call.

rkpathak commented 16 hours ago

@cedomm Enhanced tracking protection disables 3P cookies. This in turn is causing issues with the getAccessTokenAPI. Refer to https://learn.microsoft.com/en-us/office/dev/add-ins/develop/troubleshoot-sso-in-office-add-ins#13001 for workaround of this error code.