Word online SSO - getAccessTokenAsync нет ответа нет ошибки

Я создал надстройку 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

Веб-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 / электронную таблицу онлайн, он может получить токен, вызвав 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>

Я заметил, что в вашем элементе <Resource> есть пара пробелов. Удалите их и попробуйте еще раз. Если это не поможет, попробуйте использовать инструмент Fiddler или Charles для захвата запроса / ответа из Office в AAD. Кроме того, подождите не менее 31 секунды после первой попытки, прежде чем снова вызвать getAccessTokenAsync.

Rick Kirkham 01.06.2018 20:05

В работающем коде не было пробелов. Fiddler ничего мне не дает, когда надстройка используется в Word в Интернете. Но если я использую его в Powerpoint, я получаю токен, а также могу найти его с помощью fiddler.

InnovateIt 05.06.2018 11:10

Я обратился за помощью к группе разработчиков продукта Microsoft. Кто-то сообщит здесь о том, что мы обнаружим.

Rick Kirkham 05.06.2018 20:35

Пока мы ждем, сколько элементов Host в вашем манифесте? Есть один для презентации? Есть ли один для документа? Кроме того, работает ли он на рабочем столе Word? Это работает в PowerPoint Online?

Rick Kirkham 05.06.2018 21:48

Можете ли вы предоставить нам части вашего манифеста, связанные с хостом Word и хостом PowerPoint, со скрытыми личными данными и идентификаторами GUID? Это дает нам возможность сравнивать. Кроме того, хранится ли файл Word, который вы открываете в Word Online, в том же месте, что и файл PowerPoint, который работает в PowerPoint Online?

Rick Kirkham 05.06.2018 22:38

Я создал один файл манифеста для Word с hoste = Document и копию файла с hoste = Presentation. В powerpoint работает нормально. Я как пытался скрыть манифест, так и вытолкнул его из офисного онлайн-портала с тем же результатом. Я использую onedrive для хранения документов и презентаций

InnovateIt 06.06.2018 08:20

Команда продукта просит вас предоставить весь свой манифест на GitHub и предоставить ссылку на него. Кроме того, при вызове getAccessTokenAsync с Word Online запустите Fiddler. Включите записи Fiddler в репозиторий GitHub.

Rick Kirkham 13.06.2018 01:43

После возобновления проекта после двухмесячной паузы теперь я получаю ответ с токеном. Я не менял код.

InnovateIt 19.07.2018 08:03
Стоит ли изучать PHP в 2026-2027 годах?
Стоит ли изучать PHP в 2026-2027 годах?
Привет всем, сегодня я хочу высказать свои соображения по поводу вопроса, который я уже много раз получал в своем сообществе: "Стоит ли изучать PHP в...
Поведение ключевого слова "this" в стрелочной функции в сравнении с нормальной функцией
Поведение ключевого слова "this" в стрелочной функции в сравнении с нормальной функцией
В JavaScript одним из самых запутанных понятий является поведение ключевого слова "this" в стрелочной и обычной функциях.
Приемы CSS-макетирования - floats и Flexbox
Приемы CSS-макетирования - floats и Flexbox
Здравствуйте, друзья-студенты! Готовы совершенствовать свои навыки веб-дизайна? Сегодня в нашем путешествии мы рассмотрим приемы CSS-верстки - в...
Тестирование функциональных ngrx-эффектов в Angular 16 с помощью Jest
В системе управления состояниями ngrx, совместимой с Angular 16, появились функциональные эффекты. Это здорово и делает код определенно легче для...
Концепция локализации и ее применение в приложениях React ⚡️
Концепция локализации и ее применение в приложениях React ⚡️
Локализация - это процесс адаптации приложения к различным языкам и культурным требованиям. Это позволяет пользователям получить опыт, соответствующий...
Пользовательский скаляр GraphQL
Пользовательский скаляр GraphQL
Листовые узлы системы типов GraphQL называются скалярами. Достигнув скалярного типа, невозможно спуститься дальше по иерархии типов. Скалярный тип...
1
8
143
0

Другие вопросы по теме