I'm trying to implement facebook business login for instagram. Below is my constructed url and the href tag calling that URL. However, the flow gets stuck at connect to instagram with the error
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.facebook.com') does not match the recipient window's origin ('https://web.facebook.com'). DO
const FACEBOOK_LOGIN_URL = `https://www.facebook.com/${FACEBOOK_API_VERSION}/dialog/oauth?client_id=${process.env.NEXT_PUBLIC_FACEBOOK_CLIENT_ID}&client_secret=${process.env.NEXT_PUBLIC_FACEBOOK_APP_SECRET}&display=page&extras={'setup':{'channel':'IG_API_ONBOARDING'}}&redirect_uri=${process.env.NEXT_PUBLIC_FACEBOOK_LOGIN_REDIRECT_URI}&response_type=token&scope=instagram_basic,pages_show_list,business_management,instagram_manage_messages,pages_manage_metadata,pages_messaging`;
<a
href={`${FACEBOOK_LOGIN_URL}`}
className="flex flex-row items-center"
>
Login to Facebook
</a>
I tried using "web.facebook.com" inplace of "www.facebook.com" and i still get the same issue.
Anyone run into this before and know how to fix it?
I see you're passing
client_secretin the url.I think that's a bad idea because that's sensitive information that should not be publicly available. Also, the docs for Business Login for Instagram does not specify a field called
client_secret.Just want to chime in because I'm facing the same issue. I can add that if I sign into Instagram with a "normal" profile, then it makes me convert it to a professional account. I'm still stuck at the same place as you afterwards, though.