Open ghost opened 11 years ago
I have the very same problem with similar settings (I use only one provider and one firewall).
User is authenticated on the client side but server side authentication is not working. How can we debug this?
Thanks
Yes got it too on the 2.1.6 build of symfony.
Yeah same here.. I tried many tutoriel and thought the issue could come from my facebook parameters..
Hi in your facebook provider, try to add:
Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;
Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYHOST] = 2;
Like this:
public function __construct(BaseFacebook $facebook, $userManager, $validator, $container)
{
$this->facebook = $facebook;
Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false;
Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYHOST] = 2;
$this->userManager = $userManager;
$this->validator = $validator;
$this->container = $container;
}
that fixed the problem for me.
Hi! Thanks for your answer :)
I have this error message :
Fatal error: Class 'MyApp\UserBundle\Security\User\Provider\Facebook' not found in C:\WAmp\www\sf\src\MyApp\UserBundle\Security\User\Provider\FacebookProvider.php on line 24
@wedd: can you post on gist your FacebookProvider.php?
@wedd
add this at the top of your php file:
use Facebook;
edit: to make sure you have all the right usages:
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Facebook;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use \BaseFacebook;
use \FacebookApiException;
Thanks both of you for your answers. Now, I have this message "The Facebook user could not be retrieved from the session."
Edit : My FacebookProvider.php ( https://gist.github.com/wedd/c57cfed09eded901cfad )
It was broken only when using Chrome on localhost for me (#102).
@wedd:
https://coderwall.com/p/qkdzca I wrote down here how I integrated it. Look closely at the security, routing, ... because probably that's where the problem is.
Here is my firewall configuration: https://gist.github.com/vinceve/4770079
and here is my facebook provider: https://gist.github.com/vinceve/4770064
@Pajk I'm using it on my localhost in chrome... But I can't use 127.0.0.1 that doesn't seem to work (doesn't want to redirect, because of the javascript).
Actually its the same for me, on localhost with Chrome is not working "The Facebook user could not be retrieved from the session." But in Firefox on localhost thats just fine..! "Welcome 723978XXX Logout"
in https://github.com/FriendsOfSymfony/FOSFacebookBundle/issues/102 I found "Great, I just noticed I had the "Block third-party cookies and site data" option enabled in Chrome. Disabling this fixed the problem for me ;-)" But unfortunatly didnt work for me.. The same parameter was already unchecked (Bloquer les cookies et les données de site tiers)..
@jujuo
How are you authenticating ? Is it with the twig tags and the javascript redirect ? Could you give me your current url, callback url (as in what facebook returns) and could you try adding in your onFbInit() method :
function onFbInit() {
if (typeof(FB) != 'undefined' && FB != null) {
FB.Event.subscribe('auth.statusChange', function (response) {
console.log(goLogin);
return false;
setTimeout(goLogIn, 300);
});
}
}
and then post the output of your console here ?
Hey ! So I used that tutorial (Its in French but well I guess you dont need the explanations but just the code :) ) : http://devyourdream.net/2012/10/06/fosfacebookbundle-fosuserbundle-installation-et-configuration-pas-a-pas/#comment-796629794 By the way if you see something "weird" there dont hesitate to tell me.
About the log I give you that in a minute
The console returns that " function goLogIn() { window.location = "/web/app_dev.php/login_facebook_check"; } "
oh sorry my bad.. can you do a console.log(response) (that's what I actually needed)
I pasted a few errors i got as well in case of..
www.facebook.com/plugins/login_button.php?scope=email%2Cuser_birthday%2Cuser_location&size=medium&show_faces=false&max_rows=1&app_id=290944534366248&locale=fr_FR&sdk=joey&channel=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D18%23cb%3Df2c302f104%26origin%3Dhttp%253A%252F%252Flocalhost%252Ff1ca0c196%26domain%3Dlocalhost%26relation%3Dparent.parent:1 Unsafe JavaScript attempt to access frame with URL http://localhost/myApp/web/app_dev.php/login from frame with URL https://www.facebook.com/plugins/login_button.php?scope=email%2Cuser_birthd…ain%3Dlocalhost%26relation%3Dparent.parent&ret=perms&hash=AQAv0MxJ9dkr0Vea. The frame requesting access has a protocol of 'https', the frame being accessed has a protocol of 'http'. Protocols must match.
www.facebook.com/plugins/login_button.php?scope=email%2Cuser_birthday%2Cuser_location&size=medium&show_faces=false&max_rows=1&app_id=290944534366248&locale=fr_FR&sdk=joey&channel=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D18%23cb%3Df2c302f104%26origin%3Dhttp%253A%252F%252Flocalhost%252Ff1ca0c196%26domain%3Dlocalhost%26relation%3Dparent.parent&ret=perms&hash=AQAv0MxJ9dkr0Vea:1 Unsafe JavaScript attempt to access frame with URL http://localhost/myApp/web/app_dev.php/login from frame with URL http://static.ak.facebook.com/connect/xd_arbiter.php?version=18#cb=f35cfc06…FRYKQsJB0tJsUjYol04fZAOgZDZD&expires_in=5789&base_domain=localhost&https=1. Domains, protocols and ports must match.
static.ak.facebook.com/connect/xd_arbiter.php?version=18#cb=f35cfc0624&origin=http%3A%2F%2Flocalhost%2Ff1ca0c196&domain=localhost&relation=parent&code=AQD2-dt_C35s6lvh_zPx8bLKP_n94kW7T5rfNpMYKO6YVWXZZV8EeZ3QeMXoNjm8n128VVq6Lh8aM6yrHtosDfMdgFAFZPG1zsNRcidwp1MjPW8N8AnchG-i-i87tEkjrcayHe88heX1QerJhfbD5u1xXN0Q7aavmsygRvTF262ijqlVGxSjdsqjV2ik0c8cOmFz3scqPGD87kWBccsOWbOn&signed_request=VHlZHSgMmgqUuWSHwND-L8Sdy4JPKVl1ZIN6N5jSDsQ.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNvZGUiOiJBUURRdmFsS0RNWmdjb2tHSGRZSzZYOWl0YnQ5d2xXeVB4WWMzei1LWjRIdmRmMFVPRVdfX09vSFVQUll1NFJMT21LTjd1a1pacjI0cWVucVRkY3NROTR1SENzY0lMQUkyZzVCVTVkQ095N21XcWxDYmpfbFNZMXJuNzIxZGUzMENiQ194ajhna2FSVzk4YV83TE1HbS1OTFhSU1dZUHp3aWd1UHFKenYyRDRtWjNhRk1mUTFlY2laMTZ6clJRX3JiVW5nMmVPRzhSdGJwZlo1ekwtUEg2RjQiLCJpc3N1ZWRfYXQiOjEzNjA2OTM0MTEsInVzZXJfaWQiOiI3MjM5Nzg0NDAifQ&access_token=AAAEInM3eyCgBANJNAsw5iutHewN0vo1RV7fkBOXIEDryBAGqD6ZAiPNaarJKt82IHVEdWIoYBNgeQuZATFRYKQsJB0tJsUjYol04fZAOgZDZD&expires_in=5789&base_domain=localhost&https=1:1
Object {authResponse: Object, status: "connected"} authResponse: Object accessToken: "AAAEInM3eyCgBANJNAsw5iutHewN0vo1RV7fkBOXIEDryBAGqD6ZAiPNaarJKt82IHVEdWIoYBNgeQuZATFRYKQsJB0tJsUjYol04fZAOgZDZD" expiresIn: 5789 signedRequest: "VHlZHSgMmgqUuWSHwND-L8Sdy4JPKVl1ZIN6N5jSDsQ.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNvZGUiOiJBUURRdmFsS0RNWmdjb2tHSGRZSzZYOWl0YnQ5d2xXeVB4WWMzei1LWjRIdmRmMFVPRVdfX09vSFVQUll1NFJMT21LTjd1a1pacjI0cWVucVRkY3NROTR1SENzY0lMQUkyZzVCVTVkQ095N21XcWxDYmpfbFNZMXJuNzIxZGUzMENiQ194ajhna2FSVzk4YV83TE1HbS1OTFhSU1dZUHp3aWd1UHFKenYyRDRtWjNhRk1mUTFlY2laMTZ6clJRX3JiVW5nMmVPRzhSdGJwZlo1ekwtUEg2RjQiLCJpc3N1ZWRfYXQiOjEzNjA2OTM0MTEsInVzZXJfaWQiOiI3MjM5Nzg0NDAifQ" userID: "723978442"
@jujuo I think there is a way to change protocols in the facebook app itself. If you do that, it'll work. I'll check it out and update my findings here.
Wow that would be great indeed
On Wednesday, February 13, 2013, vinceve wrote:
@jujuo https://github.com/jujuo I think there is a way to change protocols in the facebook app itself. If you do that, it'll work. I'll check it out and update my findings here.
— Reply to this email directly or view it on GitHubhttps://github.com/FriendsOfSymfony/FOSFacebookBundle/issues/234#issuecomment-13486815.
Julien
@jujuo did you resolved this issue?? i have exactly the same issue now :( The Facebook user could not be retrieved from the session.
I don't remember exactly unfortunately but I think it as a chrome or firefox issue when i used localhost. If you use localhost as well, (sounds weird but..) try another browser.
Hello,
I have a similar problem except that I'm not used localhost. My error is : "Unknown SSL protocol error in connection to graph.facebook.com:443". I have tried to fix with this two lines (without success) :
Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYPEER] = false; Facebook::$CURL_OPTS[CURLOPT_SSL_VERIFYHOST] = 2;
Thanks for your help.
I followed the differents steps of FOSFacebookBundle with success but I can't logged me in. I have this message "The Facebook user could not be retrieved from the session."
I have Symfony 2.1.7, Facebook SDK 3.2.0, FOSFB 1.1.0 and FOSUB 1.3.1
Thx :)
security.yml
config.yml :
routing.yml