0

当尝试实现以下逻辑时,我们能够在重定向 url 浏览器中获取访问令牌,例如 https://localhost:3000/taskpane.html#id_token= "xxxxxxxx...." 但无法像在任务窗格中一样进入原点。 ts 文件。

taskpane.ts 中的代码:

if (OfficeHelpers.Authenticator.isAuthDialog())
return;

let authenticator = new OfficeHelpers.Authenticator;

authenticator.endpoints.add('OauthTest', {
baseUrl:"https://qa-xxxx.xxxx.com/",
authorizeUrl: "/connect/authorize",
tokenUrl: "/connect/token",
clientId: "https://qa-xxxx.xxxx.com/",
responseType: "id_token",
redirectUrl: "https://localhost:3000/taskpane.html",
scope:"openid profile",
state: true,
nonce:true
})
authenticator
.authenticate('OauthTest',true)
.then(token => {
var test=token;
let authObject = authenticator.tokens.get("OauthTest");
let accessToken = authObject.access_token;
console.log(JSON.stringify(token1));
console.log(OfficeHelpers.Authenticator.getUrlParams());
})
.catch(OfficeHelpers.Utilities.log);

在清单中:

https://localhost:3000 , https://localhost:3000/taskpane.html , https://qa-xxxx.xxxx.com

问题:

无法在“DOMWindow”上执行“postMessage”:提供的目标来源(“ https://qa-xxxx.xxxx.com ”)与收件人窗口的来源(“ https://localhost:3000 ”)不匹配。

4

0 回答 0