0

When trying to implement below logic we were able to get access token in redirect url browser like https://localhost:3000/taskpane.html#id_token="xxxxxxxx...." but not able to get in origin like in taskpane.ts file.

Code in 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);

In Manifest :

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

Issue:

Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://qa-xxxx.xxxx.com') does not match the recipient window's origin ('https://localhost:3000').

James Z
  • 12,209
  • 10
  • 24
  • 44

0 Answers0