Shade- / MyFacebook-Connect

A plugin to integrate Facebook with MyBB, letting users login and register through Facebook.
27 stars 24 forks source link

Wrong redirect/message after successful Facebook login ("you are already logged in") #31

Closed illtellyoulater closed 10 years ago

illtellyoulater commented 10 years ago

When the user is registering with myfacebook connect and after they accept the request for permissions by Facebook, they are redirected to an address of this type:

.../myfbconnect.php?action=do_login&code=AQD4JpWw09K3qBxgtQ7-1tKVjx_PZXeG9mPZcQqfPqSmvFdRI3mLs883wsqWH510pMEYbjn0_GUjL_nUXVM4ZGVJbBIKfBXECE8L-[...]&state=d84b6e18747a934d45ca79269a1bfaca#_=_

and a message saying "You are already logged into the board" is outputed.

How can I fix this? I took a look at the code, and in /src/base_facebook.php there is a line saying:

redirect_uri => $currentUrl, // possibily overwritten

has it do do with this? Thanks.

Shade- commented 10 years ago

No, that's not related to this issue, which has been reported a lot of times but I never managed to fix it. The code is correct and checks for the right substrings in the redirect URL; but, since this is pretty annoying both for you and for me, I will change the code completely.

In the meantime, ensure the register/login URL is NOT myfbconnect.php?action=fblogin, but myfbconnect.php?action=login, fblogin --> login. Characters matters. This should fix the issue.

illtellyoulater commented 10 years ago

Login URL is "/forum/myfbconnect.php?action=login"

Of course it does matter if I Just click on a link pointing at that location versus copying the login link in the address bar: only in the second case I see the "you are already logged in" message. Except when registering, where even though I click on the login link, after granting FB permissions, and being shown registering with Facebook was successfully, I see the already logged in message.

To fix it very temporarily I redirect to the home page with a Javascript redirect. Il 15/set/2014 23:12 "Filippo Rossi" notifications@github.com ha scritto:

No, that's not related to this issue, which has been reported a lot of times but I never managed to fix it. The code is correct and checks for the right substrings in the redirect URL; but, since this is pretty annoying both for you and for me, I will change the code completely.

In the meantime, ensure the register/login URL is NOT myfbconnect.php?action=fblogin, but myfbconnect.php?action=login, fblogin --> login. Characters matters.

— Reply to this email directly or view it on GitHub https://github.com/Shade-/MyFacebook-Connect/issues/31#issuecomment-55659818 .

Shade- commented 10 years ago

Interessante. Nessuno ha mai fatto un report così dettagliato, ora dovrei riuscire a capire perché non funziona.

illtellyoulater commented 10 years ago

Puoi avvisarmi qui quando hai un modo x farlo funzionare? Te lo chiedo perché hai messo closed, grazie

Shade- commented 10 years ago

Il commit che ho applicato (https://github.com/Shade-/MyFacebook-Connect/commit/8a95008539467b6eafe22b4d71d9782c7ce1b965) a cui ho fatto riferimento dovrebbe risolvere il problema. Non potendo riprodurre l'errore (sembra legato a configurazioni particolari di PHP che non posso replicare nella mia test board) tocca a te o a qualcun altro testare la patch. È sufficiente che rimpiazzi il file inc/plugins/MyFacebookConnect/class_facebook.php con quello modificato.

illtellyoulater commented 10 years ago

Attualmente non posso provare perchè sto avendo problemi ad accedere alle API di FB ("Unauthorized source IP address") pare che abbiano blacklistato il mio IP senza una ragione... appena risolvo testerò!

illtellyoulater commented 10 years ago

ho avuto occasione di testare il codice e volevo confermare che ora funziona come previsto