简体   繁体   中英

Facebook PHP-SDK login works … most of the time?

I have successfully created facebook login on my web-app, it really works , but from time to time some user pops up and says that browser gives him "This webpage has a redirect loop".

Because it works in most of the time - respectively it works for most of the users, I wont share the code, because it would not help anything probably. However feel free to ask any more needed info.

Have anyone ever had a similar problem? What might caused this?

Is there a posibility of Facebook returning i different structure data for different users?

While I was searching for a solution I ran up into page when somebody claimed that he solved it by adding something about SSL in the SDK's CURL connection to facebook.

Some users even claim they have been able to login just fine but the problem started after some time.

But the common scenario is that user clicks login with facebook, gets redirected to the facebook verification/app enabling => is redirected back to my site ( and here some users - not everyone - gets the browser's redirection loop error ). If everything went fine user is logged in and redirected to his/her profile. If he/she denied the app the error is showed to him/her.

I had exactly same error "This webpage has a redirect loop". Then i tried another code, and it worked perfectly fine.

Here is the link to the code, you can also download entire source code and enter your facebook credentials, it will work. I have used same code for my website.

http://www.sanwebe.com/2012/05/ajax-facebook-connect-with-jquery-php

Third Party Cookies and Facebook

Safari is normally the culprit for this type of error! It is often related to the 3rd party cookie rules in safari. By default Safari does not allow 3rd party cookies to be set (to stop invasive advertising), if you disable this in the settings it should prevent the infinite loop!

When using Facebook controls on your website, it need to be able to set cookies for authentication. These are considered 3rd party cookies (in safari are blocked by default). The facebook dialog you are calling must be request by the user (meaning the user has to have clicked it) in order for the browser to consider this a normal request and not 3rd party.

Safari is not the only browser which has 3rd party cookie settings, so i would suggest trying it in other browsers too! If you can replicate the problem then you can solve it!

This article will show you how to control 3rd party cookies in each browser!

http://feedjit.com/static/howToEnableThirdPartyCookies.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM