I have an Ionic 6 application that opens a url using InAppBrowser and I need to capture a token that this website generates. Searching the internet I found the window.postMessage, I put this function on my website to send the token to my application
window.postMessage(token, 'https://my-url.net');
Now in my Ionic app, I do the following to try to receive this token
const browser = this.iab.create(environment.checkoutUrl, '_blank')
browser.show();
browser.on('message').subscribe((event) => {
console.log('test')
console.log(event)
})
And I never got the token in my message event. Can anyone help me to solve this problem?