Office.js | implement single sign in excel add-in

非 Y 不嫁゛ 提交于 2021-01-04 06:43:12

问题


I am using Office.js, javascript and react to create excel add-ins. Wants to implement single sign-in flow using ribbon button. Once user successfully sign in then only wants to show task pane to user.

  1. I have configured add-in using shared runtime(manifest.xml)
  2. I have added Login command in ribbon and executing action from manifest file by using below code.

Below is the Action from manifest file. 'btnlogin' function gets executed on click of login icon from ribbon

<Action xsi:type="ExecuteFunction">
    <TaskpaneId>DataDirectId</TaskpaneId>
    <FunctionName>btnlogin</FunctionName>
    <SourceLocation resid="LGButton.Url" />
</Action>

using Office.context.ui.displayDialogAsync() inside btnlogin function and passing "oauth2" authorization URL to dialog. URL is on different HOST. And if pass open dialog as i-frame then receiving X-FRAME-OPTIONS = DENY in response header due to it authorization URL Refused to display on I-frame. If i dont pass displayInIframe then authorization URL opens. Also i added authorization URL host inside "AppDomain".

Authorization URL opens username/pass window inside dialog and once user pass correct user name/pass authorization URL redirects to provided path. e.g below is my Authorization URL which i'm trying to open inside dialog: https://google.com?response_type=abc&client_Id=xyz&**redirect_uri=https://application-url-to-redirect**

Please help to implement below scenario: On entering of correct username/pass wants to close the dialog and open redirection_URI on task pane.

We are using hash router in our application.

Do i need to use any react-oidc or passport-auth lib ? please suggest and help for implementing same.

来源:https://stackoverflow.com/questions/64485738/office-js-implement-single-sign-in-excel-add-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!