I’m new to salesforcce developement tried integrating two salesforce org’s using oAuth Webserver flow i’m getting the callback code to a vf page but when i’m sending the code using post messages to Lwc it’s throwing following error
Can any one suggest a way to do oAuth Web server flow using Lwc
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://bnthinc-8d-dev-ed.develop.lightning.force.com') does not match the recipient window's origin ('https://bnthinc-8d-dev-ed--testingbnth.develop.vf.force.com').
Code in vf Page to Post Message
<apex:page >
<script>
//window.top.postMessage(window.location.hash.substring(1),'https://bnthinc-8d-dev-ed.develop.lightning.force.com');
parent.postMessage('Code','https://bnthinc-8d-dev-ed.develop.lightning.force.com');
</script>
</apex:page>
Code in LWC to Catch Message
doAuth(){
let oAuthUrl=`${BASE_URL}?client_id=${client_Id}&redirect_uri=${redirected_Uri}&response_type=code`;
window.open(oAuthUrl);
window.onmessage((msg)=>{
console.log('Data>>',msg.data);
console.log('Message>>',msg);
})
}
I’m new to salesforcce developement tried integrating two salesforce org’s using oAuth Webserver flow i’m getting the callback code to a vf page but when i’m sending the code using post messages to Lwc it’s throwing following error
Can any one suggest a way to do oAuth Web server flow using Lwc
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://bnthinc-8d-dev-ed.develop.lightning.force.com') does not match the recipient window's origin ('https://bnthinc-8d-dev-ed--testingbnth.develop.vf.force.com').