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
658 stars 94 forks source link

Outlook mobile - intent link opens in webview #2707

Closed Iso5786 closed 3 months ago

Iso5786 commented 2 years ago

Message from office-js bot: We’re closing this issue because it has been inactive for a long time. We’re doing this to keep the issues list manageable and useful for everyone. If this issue is still relevant for you, please create a new issue. Thank you for your understanding and continued feedback.

Outlook mobile - intent link opens in webview

Your Environment

Expected behavior

Intent URL opens intended app on the phone

Current behavior

However, webview tries to open the intent URLs.

Steps to reproduce

  1. Install Outlook on mobile
  2. Install PostGuard (https://postguard.eu/) addon to mail account (currently I do not want to publicly share link to our manifest, however, repo is https://github.com/encryption4all/postguard-outlook-addon)
  3. Send PostGuard encrypted mail to that mail account
  4. Try to decrypt email via PostGuard addon
  5. Click on "Open IRMA app" button

Context

The user needs to disclose attributes with the IRMA app to authenticate to the TTP to be able to decrypt an PostGuard encrypted email.

Useful logs

exextoc commented 1 year ago

@Iso5786 could you please share a small snippet of the part of the code where your redirect takes place? Or the redirect Url itself? This would help us quickly pinpoint the source of the issue.

Iso5786 commented 1 year ago

What do you exactly mean with redirect? The intent link generated?

I can provide several references to external libraries responsible for generating and showing the intent link:

exextoc commented 1 year ago

From what we can understand you're trying to use a web link URL to redirect to your Android app from Outlook Mobile through the add-in. Ideally, if this URL is entered into the browser, we should see it redirect to your Postguard App or install link. Is this assumption correct? If so, can you give us a sample URL that you would redirect to- which you would expect your PostGuard App to intercept?

Iso5786 commented 1 year ago

I am not sure if an intent link is a web link URL. So I think the web view should not even open, but Outlook should redirect directly to the intended app. The intent URL is: intent://qr/json/%7B%22u%22%3A%22https%3A%2F%2Fihub.ru.nl%2Firma%2F1%2Fsession%2FJbWoxfsP7YvWbA8ZpA9N%22%2C%22irmaqr%22%3A%22disclosing%22%7D#Intent;package=org.irmacard.cardemu;scheme=irma;l.timestamp=1659078974962;end

exextoc commented 1 year ago

Can you please share a short repro video and code snippet which is responsible for redirecting the intent URL to the IRMA app for further debugging??

Iso5786 commented 1 year ago

Not sure what the repro video should additionally show as what happens in the background is that a IRMA session is started, and the frontend-package subsequently generates the link. If I click then on the button with the link within the taskpane of the addon, the webview opens with the error shown above. The link is attached as href attribute to the button element (sourcecode) Further there is no code responsible for redirecting to the IRMA app other than the intent URL I provided. On this stackoverflow topic an Android DEV says: "Alternatively, there is the "intent:" scheme. This allows you to describe nearly any Intent as a URI, which the browser will try to launch when clicked"

exextoc commented 1 year ago

Can you please try with getLaunchIntentForPackage instead of intent URI.

ghost commented 1 year 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!

Iso5786 commented 1 year ago

The IRMA component we utilize is written in Javascript as we develop an addin based on officejs. So I don't see a way how to use the getLaunchIntentForPackage function .. The IRMA intent links work well within other browsers / webviews.

exextoc commented 1 year ago

Hey @Iso5786 , I think there's a bit of confusion in understanding this issue. Can you share any public documentation available to attempt what you're doing (opening an intent link from an URL), so that we can investigate further.

Iso5786 commented 1 year ago
  1. We develop an Outlook office-js addon to encrypt emails.
  2. Within the addon we start an IRMA session (https://github.com/encryption4all/postguard-outlook-addon/blob/519bbbdc00e446776d4bf80765c505b12c950fba/src/decryptdialog/decrypt.ts#L350).
  3. The IRMA session is handled by the IRMA frontend packages (https://github.com/privacybydesign/irma-frontend-packages)
  4. The IRMA packages generate either a QR code for a desktop session (to be scanned with the IRMA app), or an intent URL for a mobile session (such that the IRMA app opens when clicking on a button within a mobile browser).
  5. The src code for the intent link generation can be found here: https://github.com/privacybydesign/irma-frontend-packages/blob/157c07beaadd06468531954800449cc2357ec48d/plugins/irma-client/state-client.js#L289
  6. An example of a generated intent link is: intent://qr/json/%7B%22u%22%3A%22https%3A%2F%2Fihub.ru.nl%2Firma%2F1%2Fsession%2FJbWoxfsP7YvWbA8ZpA9N%22%2C%22irmaqr%22%3A%22disclosing%22%7D#Intent;package=org.irmacard.cardemu;scheme=irma;l.timestamp=1659078974962;end
exextoc commented 1 year ago

Thanks @Iso5786 ,

What I meant was, is there a public documentation about how "intent://qr/json" type links are supposed to work inside of Android, and how they are handled?

Iso5786 commented 1 year ago

This is the official Android documentation: https://developer.android.com/guide/components/intents-filters

exextoc commented 1 year ago

Hey @Iso5786 , from what we can see, this documentation provides instructions on how to invoke intent from within the app. Can you share any documentation about opening an intent URL from the browser or a WebView and what is the expected behaviour?

Iso5786 commented 1 year ago

Hi, I asked one of the IRMA developers and he provided me with the following: