Word онлайн SSO - getAccessTokenAsync нет ответа нет ошибки - PullRequest
0 голосов
/ 01 июня 2018

Я создал надстройку Office для Word Online, но не могу заставить работать единый вход.

Когда активирована надстройка, Word Online предлагает пользователю принять разрешения надстройки, но я не могу получить токен единого входа через Office.js.

Когда getAccessTokenAsync()Первый называется, я не получаю ответа или ошибок.Если я снова вызываю функцию, я получаю код ошибки 13008.Это означает, что операция выполняется, но результат никогда не возвращается.

Файл манифеста предоставляется с

<WebApplicationInfo>
    <Id>00e69b3f-c86c-4764-9e6e-xxxxxxxx</Id>
    <Resource>api://localhost:43443/00e69b3f-c86c-4764-9e6e-xxxxxxxx </Resource>
    <Scopes>
        <Scope>openid</Scope>
        <Scope>offline_access</Scope>
        <Scope>user.read</Scope>        
        <Scope>profile</Scope>
    </Scopes>
</WebApplicationInfo>

Регистрация конечной точки Azure v2

Надстройка зарегистрирована на https://apps.dev.microsoft.com

Платформа Web Api:

api://localhost:43443/00e69b3f-c86c-4764-9e6e-xxxxxxxx

Предварительно авторизованное приложение:

bc59ab01-8403-45c6-8796-ac3ef710b3e3
57fb890c-0dab-4253-a5e0-7188c88b2bb4
d3590ed6-52b3-4102-aeff-aad2292ab01c

Разрешения:

openid
offline_access
user.read
Profile

Я предоставил согласие администратора, используя https://login.microsoftonline.com/common/adminconsent?client_id=00e69b3f-c86c-4764-9e6e-xxxxxxxx&state=12345

Обновление:

Если тот же манифест загружен в Powerpoint онлайн или в Excel / Spreadsheet онлайн, то этоможно получить токен, вызвав getAccessTokenAsync (), но все еще не в Word Online

Хост документов

  <Hosts>
      <!--Each host can have a different set of commands. Cool huh!? -->
      <!-- Workbook=Excel Document=Word Presentation=PowerPoint -->
      <!-- Make sure the hosts you override match the hosts declared in the top section of the manifest -->
      <Host xsi:type="Document">
	  


        <!-- Form factor. Currenly only DesktopFormFactor is supported. We will add TabletFormFactor and PhoneFormFactor in the future-->
        <DesktopFormFactor>

          <!--GetStarted information used on the callout that appears when installing the add-in. 
            Ensure you have build 16.0.6769 or above for GetStarted section to work-->
          <GetStarted>
            <!--Title of the Getting Started callout. resid points to a ShortString resource -->
            <Title resid="dt.GetStarted.Title"/>

            <!--Description of the Getting Started callout. resid points to a LongString resource -->
            <Description resid="dt.GetStarted.Description"/>

            <!--Not used right now but you need to provide a valid resource. We will add code in the future to consume this URL. 
							resid points to a Url resource -->
            <LearnMoreUrl resid="dt.GetStarted.LearnMoreUrl"/>
          </GetStarted>

          <!--Function file is an html page that includes the javascript where functions for ExecuteAction will be called. 
            Think of the FunctionFile as the "code behind" ExecuteFunction-->
          <FunctionFile resid="dt.FunctionFile.Url" />
          

          <!--PrimaryCommandSurface==Main Office Ribbon-->
          <ExtensionPoint xsi:type="PrimaryCommandSurface">
            <!--Use OfficeTab to extend an existing Tab. Use CustomTab to create a new tab -->
            <!-- Documentation includes all the IDs currently tested to work -->
            <CustomTab id="dt.Tab1">
              <!--Group ID-->
              <Group id="dt.Tab1.Group1">
                <!--Label for your group. resid must point to a ShortString resource -->
                <Label resid="dt.Tab1.GroupLabel" />
                <Icon>
                  <!-- Sample Todo: Each size needs its own icon resource or it will look distorted when resized -->
                  <!--Icons. Required sizes 16,31,80, optional 20, 24, 40, 48, 64. Strongly recommended to provide all sizes for great UX -->
                  <!--Use PNG icons and remember that all URLs on the resources section must use HTTPS -->
                  <bt:Image size="16" resid="dt.TaskpaneButton.Icon" />
                  <bt:Image size="32" resid="dt.TaskpaneButton.Icon" />
                  <bt:Image size="80" resid="dt.TaskpaneButton.Icon" />
                </Icon>

                <!--Control. It can be of type "Button" or "Menu" -->
                <Control xsi:type="Button" id="dt.LetterButton">
                  <!--Label for your button. resid must point to a ShortString resource -->
                  <Label resid="dt.LetterButton.Label" />
                 
                  <Supertip>
                    <!--ToolTip title. resid must point to a ShortString resource -->
                    <Title resid="dt.LetterButton.Label" />
                    <!--ToolTip description. resid must point to a LongString resource -->
                    <Description resid="dt.LetterButton.Tooltip" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="dt.LetterButton.Icon16" />
                    <bt:Image size="32" resid="dt.LetterButton.Icon32" />
                    <bt:Image size="80" resid="dt.LetterButton.Icon80" />
                  </Icon>
                  <!--This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFuncion or ShowTaskpane-->
                  <!--Look at the FunctionFile.html page for reference on how to implement the function -->
                  <Action xsi:type="ExecuteFunction">
                    <!--Name of the function to call. This function needs to exist in the global DOM namespace of the function file-->
                    <FunctionName>ShowDialog</FunctionName>
                  </Action>
                </Control>

                <Control xsi:type="Button" id="dt.PhraseButton">
                  <!--Label for your button. resid must point to a ShortString resource -->
                  <Label resid="dt.PhraseButton.Label" />
                  <Supertip>
                    <!--ToolTip title. resid must point to a ShortString resource -->
                    <Title resid="dt.PhraseButton.Label" />
                    <!--ToolTip description. resid must point to a LongString resource -->
                    <Description resid="dt.PhraseButton.Tooltip" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="dt.PhraseButton.Icon16" />
                    <bt:Image size="32" resid="dt.PhraseButton.Icon32" />
                    <bt:Image size="80" resid="dt.PhraseButton.Icon80" />
                  </Icon>
                  <!--This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFuncion or ShowTaskpane-->
                  <!--Look at the FunctionFile.html page for reference on how to implement the function -->
                  <Action xsi:type="ExecuteFunction">
                    <!--Name of the function to call. This function needs to exist in the global DOM namespace of the function file-->
                    <FunctionName>ShowDialog</FunctionName>
                  </Action>
                </Control>          
              </Group>
              <Group id="dt.Tab1.Group2">
                <!--Label for your group. resid must point to a ShortString resource -->
                <Label resid="dt.Tab1.GroupLabel2" />
                <Icon>
                  <!-- Sample Todo: Each size needs its own icon resource or it will look distorted when resized -->
                  <!--Icons. Required sizes 16,31,80, optional 20, 24, 40, 48, 64. Strongly recommended to provide all sizes for great UX -->
                  <!--Use PNG icons and remember that all URLs on the resources section must use HTTPS -->
                  <bt:Image size="16" resid="dt.TaskpaneButton.Icon" />
                  <bt:Image size="32" resid="dt.TaskpaneButton.Icon" />
                  <bt:Image size="80" resid="dt.TaskpaneButton.Icon" />
                </Icon>

                <Control xsi:type="Button" id="dt.SignonButton">
                  <!--Label for your button. resid must point to a ShortString resource -->
                  <Label resid="dt.SignonButton.Label" />
                  <Supertip>
                    <!--ToolTip title. resid must point to a ShortString resource -->
                    <Title resid="dt.SignonButton.Label" />
                    <!--ToolTip description. resid must point to a LongString resource -->
                    <Description resid="dt.SignonButton.Tooltip" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="dt.SignonButton.Icon16" />
                    <bt:Image size="32" resid="dt.SignonButton.Icon32" />
                    <bt:Image size="80" resid="dt.SignonButton.Icon80" />
                  </Icon>
                  <!--This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFuncion or ShowTaskpane-->
                  <!--Look at the FunctionFile.html page for reference on how to implement the function -->
                  <Action xsi:type="ExecuteFunction">
                    <!--Name of the function to call. This function needs to exist in the global DOM namespace of the function file-->
                    <FunctionName>OpenAccountStatus</FunctionName>
                  </Action>
                </Control>
              
                 <Control xsi:type="Button" id="dt.SignonButton3">
                  <!--Label for your button. resid must point to a ShortString resource -->
                  <Label resid="dt.SignonButton.Label" />
                  <Supertip>
                    <!--ToolTip title. resid must point to a ShortString resource -->
                    <Title resid="dt.SignonButton.Label" />
                    <!--ToolTip description. resid must point to a LongString resource -->
                    <Description resid="dt.SignonButton.Tooltip" />
                  </Supertip>
                  <Icon>
                    <bt:Image size="16" resid="dt.SignonButton.Icon16" />
                    <bt:Image size="32" resid="dt.SignonButton.Icon32" />
                    <bt:Image size="80" resid="dt.SignonButton.Icon80" />
                  </Icon>
                  <!--This is what happens when the command is triggered (E.g. click on the Ribbon). Supported actions are ExecuteFuncion or ShowTaskpane-->
                  <!--Look at the FunctionFile.html page for reference on how to implement the function -->
                  <Action xsi:type="ShowTaskpane">  
                    <TaskpaneId>ButtonId1</TaskpaneId>  
                    <!-- Provide a url resource id for the location that will be displayed on the task pane. -->  
                    <SourceLocation resid="Contoso.Taskpane.Url" />  
                  </Action>  
                </Control>
              </Group>

              <!-- Label of your tab -->
              <!-- If validating with XSD it needs to be at the end, we might change this before release -->
              <Label resid="dt.Tab1.TabLabel" />
            </CustomTab>
          </ExtensionPoint>
        </DesktopFormFactor>
      </Host>
...