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
641 stars 92 forks source link

Microsoft authorization within OfficeJS dialog does not redirect to the web page on IOS devices #4397

Open max-yushchuk opened 3 weeks ago

max-yushchuk commented 3 weeks ago

The user is not able to authorize to the Addin using OfficeJS dialog and Oauth 2.0 authorization code flow https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow

Previously everything has been working fine. But now it just freezes on the "login.microsoftonline.com" screen and does not redirect to the redirect_uri in the query string.

Besides everything works correctly on Android, Outlook for Windows (Classic and New), Outlook for Mac, and all browsers.

Your Environment

Expected behavior

After successful MS authorization, the user should be redirected to the redirect_uri from the query string.

Current behavior

White screen and no redirect.

Steps to reproduce

  1. Use Microsoft Oauth 2.0 authorization code flow to authorize to the Microsoft
  2. Go through the authorization process: use your email and password
  3. Click "Yes" or "No" on the "Stay signed in?" page
  4. The page becomes white and does not redirect to the appropriate redirect_uri

Context

It's critical issue because users cannot authorize to the Addin. We use MS authorization as a fallback for SSO (SSO is not supported on mobile).

Video:

https://github.com/OfficeDev/office-js/assets/18704249/576e6a78-35c2-4e9c-b5b0-42670b862a18

Screenshot: screenshot1

anjalitp commented 2 weeks ago

Could you please share the add-in manifest so that we can try reproducing the issue on our side? Also, please mention the Outlook version on which you are seeing this issue.

svehera commented 2 weeks ago

@anjalitp I am working with Max. Outlook version on IOS is 4.2414.0 Here is manifest

<?xml version="1.0" encoding="UTF-8"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
  xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0" xsi:type="MailApp">
  <!-- Begin Basic Settings: Add-in metadata, used for all versions of Office unless override provided. -->
  <!-- IMPORTANT! Id must be unique for your add-in, if you reuse this manifest ensure that you change this id to a new GUID. -->
  <Id>manifestId</Id><!--  -->
  <!--Version. Updates from the store only get triggered if there is a version change. -->
  <Version>0.0.0.1</Version>
  <ProviderName>ProviderName</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <!-- The display name of your add-in. Used on the store and various places of the Office UI such as the add-ins dialog. -->
  <DisplayName DefaultValue="DisplayName" />
  <Description DefaultValue="Description" />
  <IconUrl DefaultValue="https://localhost:44343/assets/images/logo-64.png" />
  <HighResolutionIconUrl DefaultValue="https://localhost:44343/assets/images/logo-128.png" />
  <!-- Domains that will be allowed when navigating. For example, if you use ShowTaskpane and then have an href link, navigation will only be allowed if the domain is on this list. -->
  <AppDomains>
    <AppDomain>https://login.microsoftonline.com</AppDomain>
  </AppDomains>
  <!--End Basic Settings. -->
  <Hosts>
    <Host Name="Mailbox" />
  </Hosts>
  <Requirements>
    <Sets>
      <Set Name="Mailbox" MinVersion="1.1" />
    </Sets>
  </Requirements>
  <FormSettings>
    <Form xsi:type="ItemRead">
      <DesktopSettings>
        <SourceLocation DefaultValue="https://localhost:44343" />
        <RequestedHeight>300</RequestedHeight>
      </DesktopSettings>
      <TabletSettings>
        <SourceLocation DefaultValue="https://localhost:44343" />
        <RequestedHeight>300</RequestedHeight>
      </TabletSettings>
      <PhoneSettings>
        <SourceLocation DefaultValue="https://localhost:44343" />
      </PhoneSettings>
    </Form>
  </FormSettings>
  <Permissions>ReadWriteMailbox</Permissions>
  <Rule xsi:type="RuleCollection" Mode="Or">
    <Rule xsi:type="ItemIs" ItemType="Message" FormType="Read" />
    <Rule xsi:type="ItemIs" ItemType="Appointment" FormType="Read" />
  </Rule>
  <DisableEntityHighlighting>false</DisableEntityHighlighting>
  <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
    <Requirements>
      <bt:Sets DefaultMinVersion="1.3">
        <bt:Set Name="Mailbox" />
      </bt:Sets>
    </Requirements>
    <Hosts>
      <Host xsi:type="MailHost">
        <DesktopFormFactor>
          <!-- Message Read -->
          <ExtensionPoint xsi:type="MessageReadCommandSurface">
            <!-- Use the default tab of the ExtensionPoint or create your own with <CustomTab id="myTab"> -->
            <OfficeTab id="TabDefault">
              <!-- Up to 6 Groups added per Tab -->
              <Group id="msgReadGroup">
                <Label resid="groupLabel" />
                <!-- Launch the add-in : task pane button -->
                <Control xsi:type="Button" id="msgReadOpenPaneButton">
                  <Label resid="paneReadButtonLabel" />
                  <Supertip>
                    <Title resid="paneReadSuperTipTitle" />
                    <Description resid="paneReadSuperTipDescription" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="icon16" />
                    <bt:Image size="32" resid="icon32" />
                    <bt:Image size="80" resid="icon80" />
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <SourceLocation resid="messageReadTaskPaneUrl" />
                  </Action>
                </Control>
                <!-- Go to http://aka.ms/ButtonCommands to learn how to add more Controls: ExecuteFunction and Menu -->
              </Group>
            </OfficeTab>
          </ExtensionPoint>
          <!-- Appointment read form -->
          <ExtensionPoint xsi:type="AppointmentAttendeeCommandSurface">
            <OfficeTab id="TabDefault">
              <Group id="apptReadGroup">
                <Label resid="groupLabel" />
                <!-- Task pane button -->
                <Control xsi:type="Button" id="apptReadOpenPaneButton">
                  <Label resid="paneReadButtonLabel" />
                  <Supertip>
                    <Title resid="paneReadSuperTipTitle" />
                    <Description resid="paneReadSuperTipDescription" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="icon16" />
                    <bt:Image size="32" resid="icon32" />
                    <bt:Image size="80" resid="icon80" />
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <SourceLocation resid="messageReadTaskPaneUrl" />
                  </Action>
                </Control>
              </Group>
            </OfficeTab>
          </ExtensionPoint>
          <!-- Go to http://aka.ms/ExtensionPointsCommands to learn how to add more Extension Points: MessageRead, AppointmentOrganizer, AppointmentAttendee -->
        </DesktopFormFactor>
      </Host>
    </Hosts>
    <Resources>
      <bt:Images>
        <bt:Image id="icon16" DefaultValue="https://localhost:44343/assets/images/logo-16.png" />
        <bt:Image id="icon32" DefaultValue="https://localhost:44343/assets/images/logo-32.png" />
        <bt:Image id="icon80" DefaultValue="https://localhost:44343/assets/images/logo-80.png" />
      </bt:Images>
      <bt:Urls>
        <bt:Url id="messageReadTaskPaneUrl" DefaultValue="https://localhost:44343" />
      </bt:Urls>
      <bt:ShortStrings>
        <bt:String id="groupLabel" DefaultValue="Documents" />
        <bt:String id="customTabLabel" DefaultValue="Mail" />
        <bt:String id="paneReadButtonLabel" DefaultValue="Mail" />
        <bt:String id="paneReadSuperTipTitle" DefaultValue="Documents" />
      </bt:ShortStrings>
      <bt:LongStrings>
        <bt:String id="paneReadSuperTipDescription" DefaultValue="Opens a pane displaying all available filing locations with ability to file them." />
      </bt:LongStrings>
    </Resources>
    <!-- VersionOverrides for the v1.1 schema -->
    <VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
      <Requirements>
        <!-- add information on requirements -->
        <bt:Sets DefaultMinVersion="1.3">
          <bt:Set Name="Mailbox" />
        </bt:Sets>
      </Requirements>
      <Hosts>
        <Host xsi:type="MailHost">
          <!-- add information on form factors -->
          <DesktopFormFactor>
            <!-- Message Read -->
            <ExtensionPoint xsi:type="MessageReadCommandSurface">
              <!-- Use the default tab of the ExtensionPoint or create your own with <CustomTab id="myTab"> -->
              <OfficeTab id="TabDefault">
                <!-- Up to 6 Groups added per Tab -->
                <Group id="msgReadGroup">
                  <Label resid="groupLabel" />
                  <!-- Launch the add-in : task pane button -->
                  <Control xsi:type="Button" id="msgReadOpenPaneButton">
                    <Label resid="paneReadButtonLabel" />
                    <Supertip>
                      <Title resid="paneReadSuperTipTitle" />
                      <Description resid="paneReadSuperTipDescription" />
                    </Supertip>
                    <Icon>
                      <bt:Image size="16" resid="icon16" />
                      <bt:Image size="32" resid="icon32" />
                      <bt:Image size="80" resid="icon80" />
                    </Icon>
                    <Action xsi:type="ShowTaskpane">
                      <SourceLocation resid="messageReadTaskPaneUrl" />
                      <SupportsPinning>true</SupportsPinning>
                    </Action>
                  </Control>
                  <!-- Go to http://aka.ms/ButtonCommands to learn how to add more Controls: ExecuteFunction and Menu -->
                </Group>
              </OfficeTab>
            </ExtensionPoint>
            <!-- Appointment read form -->
            <ExtensionPoint xsi:type="AppointmentAttendeeCommandSurface">
              <OfficeTab id="TabDefault">
                <Group id="apptReadGroup">
                  <Label resid="groupLabel" />
                  <!-- Task pane button -->
                  <Control xsi:type="Button" id="apptReadOpenPaneButton">
                    <Label resid="paneReadButtonLabel" />
                    <Supertip>
                      <Title resid="paneReadSuperTipTitle" />
                      <Description resid="paneReadSuperTipDescription" />
                    </Supertip>
                    <Icon>
                      <bt:Image size="16" resid="icon16" />
                      <bt:Image size="32" resid="icon32" />
                      <bt:Image size="80" resid="icon80" />
                    </Icon>
                    <Action xsi:type="ShowTaskpane">
                      <SourceLocation resid="messageReadTaskPaneUrl" />
                      <SupportsPinning>true</SupportsPinning>
                    </Action>
                  </Control>
                </Group>
              </OfficeTab>
            </ExtensionPoint>

            <!-- Message Compose -->
            <ExtensionPoint xsi:type="MessageComposeCommandSurface">
              <OfficeTab id="TabDefault">
                <Group id="msgComposeCmdGroup">
                  <Label resid="groupLabel"/>
                  <Control xsi:type="Button" id="msgReadOpenPaneButton1">
                    <Label resid="paneReadButtonLabel" />
                    <Supertip>
                      <Title resid="paneReadSuperTipTitle" />
                      <Description resid="paneReadSuperTipDescription" />
                    </Supertip>
                    <Icon>
                      <bt:Image size="16" resid="icon16" />
                      <bt:Image size="32" resid="icon32" />
                      <bt:Image size="80" resid="icon80" />
                    </Icon>
                    <Action xsi:type="ShowTaskpane">
                      <SourceLocation resid="messageReadTaskPaneUrl" />
                      <SupportsPinning>true</SupportsPinning>
                    </Action>
                  </Control>
                </Group>
              </OfficeTab>
            </ExtensionPoint>

            <!-- Go to http://aka.ms/ExtensionPointsCommands to learn how to add more Extension Points: MessageRead, AppointmentOrganizer, AppointmentAttendee -->
          </DesktopFormFactor>
          <!--Mobile-->
          <MobileFormFactor>
            <ExtensionPoint xsi:type="MobileMessageReadCommandSurface">
              <Group id="msgReadGroup">
                <Label resid="groupLabel" />
                <Control xsi:type="MobileButton" id="msgReadOpenPaneButton">
                  <Label resid="paneReadButtonLabel" />
                  <Icon xsi:type="bt:MobileIconList">
                    <bt:Image size="25" scale="1" resid="icon16" />
                    <bt:Image size="25" scale="2" resid="icon32" />
                    <bt:Image size="25" scale="3" resid="icon80" />
                    <bt:Image size="32" scale="1" resid="icon16" />
                    <bt:Image size="32" scale="2" resid="icon32" />
                    <bt:Image size="32" scale="3" resid="icon80" />
                    <bt:Image size="48" scale="1" resid="icon16" />
                    <bt:Image size="48" scale="2" resid="icon32" />
                    <bt:Image size="48" scale="3" resid="icon80" />
                  </Icon>
                  <Action xsi:type="ShowTaskpane">
                    <SourceLocation resid="messageReadTaskPaneUrl" />
                  </Action>
                </Control>
              </Group>
            </ExtensionPoint>
          </MobileFormFactor>
        </Host>
      </Hosts>
      <Resources>
        <bt:Images>
          <bt:Image id="icon16" DefaultValue="https://localhost:44343/assets/images/logo-16.png" />
          <bt:Image id="icon32" DefaultValue="https://localhost:44343/assets/images/logo-32.png" />
          <bt:Image id="icon80" DefaultValue="https://localhost:44343/assets/images/logo-80.png" />
        </bt:Images>
        <bt:Urls>
          <bt:Url id="messageReadTaskPaneUrl" DefaultValue="https://localhost:44343" />
        </bt:Urls>
        <bt:ShortStrings>
          <bt:String id="groupLabel" DefaultValue="Documents" />
          <bt:String id="customTabLabel" DefaultValue="Documents" />
          <bt:String id="paneReadButtonLabel" DefaultValue="Documents" />
          <bt:String id="paneReadSuperTipTitle" DefaultValue="Documents" />
        </bt:ShortStrings>
        <bt:LongStrings>
          <bt:String id="paneReadSuperTipDescription" DefaultValue="Opens a pane displaying all available filing locations with ability to file them." />
        </bt:LongStrings>
      </Resources>
    </VersionOverrides>
  </VersionOverrides>
</OfficeApp>
DivyaPatidar commented 1 week ago

@svehera The manifest shared above has localhost URLs, so we can not test using this manifest. Is it possible for you to share manifest with deployed URLs so that we can install and test it?

Can you also share which Office JS API you are using for dialog?

microsoft-github-policy-service[bot] commented 5 days 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!