I have website where users can login with their Facebook account. I am using javascript FB.login method to display Facebook login dialog. By default, it triggers displaying new popup window. Many users have forbidden popups in their browser. How to force facebook login dialog to be displayed in the same window where the user clicked on Login button? I can see that it works on this website
When user click on Login button, he is redirected to facebook. After he login to FB, he is redirected back to the original website. Everything in the same browser tab.
See: https://developers.facebook.com/docs/reference/dialogs/oauth/
Rather than using the FB.login(), just add a link to your page like this:
<a href="https://www.facebook.com/dialog/oauth/?client_id=YOUR_APP_ID&redirect_uri=YOUR_REDIRECT_URL&state=YOUR_STATE_VALUE&scope=COMMA_SEPARATED_LIST_OF_PERMISSION_NAMES">LOGIN!</a>
Facebook will then log the user in and redirect them back to your URL with some goodies on the querystring:
YOUR_REDIRECT_URI?
error_reason=user_denied
&error=access_denied
&error_description=The+user+denied+your+request.
&state=YOUR_STATE_VALUE
As per the Facebook documentation you can use display=page which will open in same browser window.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With