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
671 stars 96 forks source link

Outlook Mobile issues with both android and iOS #4478

Closed demkantor closed 2 months ago

demkantor commented 4 months ago

Provide required information needed to triage your issue

iOs: with the latest version of outlook for iOs, 4.2417, we are not able to send cookies between a window opened with Office.context.ui.displayDialogAsync(). This was working in 4.2408 and previous versions on both iPhone and iPad. And this does work in android mobile outlook. It feels very similar to a safari bug that was fixed in this issue a few months back. This is keeping us from or oAuth flow and making the add-in unusable in iOs

Android: Office.context.mailbox.addHandlerAsync(Office.EventType.ItemChanged... appears to have no effect in Outlook for android in email. We are able to load the add-in and use it to a degree, but when choosing an email and then opening the addin it does not see the contents of the new item on load with event handler or via Office.context.mailbox.item

Your Environment

Expected behavior

iOS: when passing cookies via a popup window created with Office.context.ui.displayDialogAsync() we expect to be able to retrieve them from the Add-in pane. this works on desktop (mac and windows), browser(all tested in) Android and previous outlook for iOS versions.

Android: be able to use an event handler like Office.context.mailbox.addHandlerAsync to register email contents. this has not worked in versions of android tested. this has worked in desktop/browser and iOS mobile

Current behavior

iOS: No cookie information will be passed to Add-in pane after authentication

Android: acts as if the add-in is not opened in an email, empty Office.context.mailbox.item item and async handler does not fire

Steps to reproduce

iOS: Load add-in Open dialog using Office.context.ui.displayDialogAsync from taskpane try sending a message using Office.context.ui.messageParent to taskpane.

Android: Load add-in use Office.context.mailbox.addHandlerAsync() or just try Office.context.mailbox.item to get itemId and other information about email

Link to live example(s)

n/a - i can create a temp one for testing if needed but cant share company add-in

Provide additional details

EDIT: there are some apple devices that work and some that do not, cant tell if its more iOS version, outlook version, device itself or some factor of the three

Screenshot 2024-05-22 at 1 09 43 PM

Context

being able to use oAuth for additional logins in iOS is needed being able to get information about an email in Android is needed

Useful logs

n/a

Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.

rajjha-msft commented 4 months ago

Hey @demkantor

Can you create a sample add-in which can be used to reproduce the issue? Also, when you're at it, please create a video of the experience you are seeing. Please share the Outlook Android client version as well.

demkantor commented 4 months ago

@rajjha-msft is there a private channel we can share our manifest with you, likely wont have time to build out a sample addin until next week

anjalitp commented 4 months ago

@demkantor Please create a private repo and share access with us.

demkantor commented 3 months ago

Upon further inspection we have narrowed the issue down a bit after using Office.context.ui.displayDialogAsync() to open a new window and sign in through oAuth there are a few issues in some iOS/outlook versions that arent present on OWA or desktop PC/Mac

  1. Office.js loads, but Office.context is an empty object so using Office.js to message parent fails
  2. fallback of window.opener to message parent isnt an option as window.opener is null, possibly due to Cross-Origin-Opener-Policy set on iframe? not sure
  3. window.postMessage() aslo isnt an option from this point as it is also undefined
  4. that leaves window.top.postMessage() which fails to send the message giving this error in the console: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('IFRAME ADDIN LOCATION') does not match the recipient window's origin ('POPUP WINDOW LOCATION')

This again is only happening in some versions of iOS/outlook and no issues in OWA or desktop outlook. and feels very similar to the issue i linked earlier where OWA in safari was filing a few months back in the same way

demkantor commented 3 months ago

@anjalitp @rajjha-msft is the above helpful to you? creating a new manifest to leverage a new addin, server, and oAuth would be a bit of work on our end also here is an image of some info where the addin is working on iOS C51DE54A-877E-45B1-B32A-D67F3EC3E118_1_201_a

here are some images where the addin is not working on iOS CDF94DD4-03D7-4976-96F1-3C312E48D598_1_201_a B3B8B1CB-AFAF-4C8F-9F92-BBA379D80523_1_201_a

mmanjaree-msft commented 3 months ago

@demkantor Please share a repro video and manifest in a private repro and share access with us.

demkantor commented 3 months ago

@mmanjaree-msft @exextoc added you to a repo, see the readme for instructions to reproduce the issue

this is a new mini add-in that mimics the same behavior, and just like in our production one this addin works just fine in desktop mac/window and browsers but fails in most (but not all) iOS versions

demkantor commented 3 months ago

@exextoc can we removed the closed status now that you have the information requested?

Swathy-Mothilal commented 3 months ago

@demkantor I apologise for asking again. Could you please share the link to the repository here? We are unable to locate your repo.

demkantor commented 3 months ago

of course, https://github.com/demkantor/demo-ms

Swathy-Mothilal commented 3 months ago

@demkantor Thanks for sharing. This leads to 404, can you grant me access to it?

demkantor commented 3 months ago

@Swathy-Mothilal added you to the repo

Swathy-Mothilal commented 3 months ago

@demkantor We did test your add-in, and on clicking "Login" button on taskpane , a login screen appears. On invoking Office.context on this page, it returns undefined error. We also see following errors in the console for the page loaded in displaydialog(refer screenshot below) and Office js is not loaded. The same behaviour is seen in Outlook Web. Is your sample add-in working in other platforms?

Screenshot 2024-07-04 at 1 03 59 PM

And, as per the doc at https://learn.microsoft.com/en-us/office/dev/add-ins/develop/auth-with-office-dialog-api, the dialog should load a page which is in same domain as taskpane page. But in this add-in, its opening up in different domains.

The first page that loads is "https://addin-dev.apps.xyz/" And the taskpane URL is "https://demo-ms.netlify.app/?xyz"

Could you please confirm the same?

demkantor commented 3 months ago

the sample app is two different domains but the production addin is two separate subdomains. This has worked for years in outlook desktop (Mac + windows) and outlook on the web (chrome, Firefox, Safari) and has worked on iOS up until recent versions. The sample app tested working on chrome and desktop Mac even with different domains. But did not work in iOS

demkantor commented 3 months ago

@Swathy-Mothilal Ok after changing out the dialog window to first open url within the same domain (not just subdomain) it is working in current iOS versions as well (using 2 extra redirects from oAuth) still, is this something that has changed recently? we have been using subdomains for our dialog window and have been able to message parent in browser/desktop/android and previous iOS versions for years now. why is it just recent versions of iOS this stopped working in and our there plans to change this?

rkpathak commented 2 months ago

@demkantor Having same domain has been a directive for display dialog. You can refer to the doc here as well. https://learn.microsoft.com/en-us/office/dev/add-ins/develop/dialog-api-in-office-add-ins#open-a-dialog-box-from-a-host-page

microsoft-github-policy-service[bot] commented 2 months ago

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

microsoft-github-policy-service[bot] commented 2 months ago

This issue has been closed due to inactivity. Please comment if you still need assistance and we'll re-open the issue.