friendsofsymfony / fosfacebookbundle Goto Github PK
View Code? Open in Web Editor NEWThis project forked from kriswallsmith/facebookbundle
NOT MAINTAINED - see https://github.com/hwi/HWIOAuthBundle
This project forked from kriswallsmith/facebookbundle
NOT MAINTAINED - see https://github.com/hwi/HWIOAuthBundle
I cannot install the Bundle with the vendor script because FOSFacebookBundle.php calles the above method which does not exist at my installation.
I use Symfony 2.0.9
PHP Fatal error: Call to undefined method Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension::addSecurityListenerFactory() in /home/lazafi/workspace/c4s/trunk/src/eenbaan/vendor/bundles/FOS/FacebookBundle/FOSFacebookBundle.php on line 25
PHP Stack trace:
PHP 1. {main}() /home/lazafi/workspace/c4s/trunk/src/eenbaan/app/console:0
PHP 2. Symfony\Component\Console\Application->run() /home/lazafi/workspace/c4s/trunk/src/eenbaan/app/console:22
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() /home/lazafi/workspace/c4s/trunk/src/eenbaan/vendor/symfony/src/Symfony/Component/Console/Application.php:118
PHP 4. Symfony\Bundle\FrameworkBundle\Console\Application->registerCommands() /home/lazafi/workspace/c4s/trunk/src/eenbaan/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:66
PHP 5. Symfony\Component\HttpKernel\Kernel->boot() /home/lazafi/workspace/c4s/trunk/src/eenbaan/vendor/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:80
PHP 6. Symfony\Component\HttpKernel\Kernel->initializeContainer() /home/lazafi/workspace/c4s/trunk/src/eenbaan/app/bootstrap.php.cache:513
PHP 7. Symfony\Component\HttpKernel\Kernel->buildContainer() /home/lazafi/workspace/c4s/trunk/src/eenbaan/app/bootstrap.php.cache:779
PHP 8. FOS\FacebookBundle\FOSFacebookBundle->build() /home/lazafi/workspace/c4s/trunk/src/eenbaan/app/bootstrap.php.cache:848
Sorry guys, but login is still not working. I get "The Facebook user could not be retrieved from the session."
Any ideas how to debug this?
My configuration:
security: encoders: Symfony\Component\Security\Core\User\User: plaintext role_hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] factories: - "%kernel.root_dir%/../vendor/bundles/FOS/FacebookBundle/Resources/config/security_factories.xml" providers: in_memory: users: user: { password: userpass, roles: [ 'ROLE_USER' ] } admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] } fos_userbundle: id: fos_user.user_manager fos_facebook: id: my.facebook.user firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false login: pattern: ^/login$ security: false public: pattern: ^/.* fos_facebook: provider: fos_facebook check_path: /validate/facebook form_login: provider: fos_userbundle check_path: /login_check anonymous: true logout: true
The documentation is missing a simple example simulating an entire authentication cycle through the FOSFacebookBundle.
Something like :
$crawler = $client->request( 'GET',$this->router()->generate('_security_login'));
$form = $crawler->selectButton('Submit')->form(array(
'_username' => self::AUTH_USERNAME,
'_password' => self::AUTH_PASSWORD
));
$this->assertTrue($crawler->filter('html:contains("Password")')->count() == 1);
$client->submit($form);
$this->assertEquals(302,$client->getResponse()->getStatusCode());
$client->followRedirect();
$this->assertEquals(200,$client->getResponse()->getStatusCode());
$this->assertTrue(mb_strpos($client->getResponse(),"Password") === false);
I would be glad to help, but I am not really sure on the way the authentication is performed.
I performed all the necessary changes after the change to the facebook sdk3.
Everything worked before, but after the upgrade I can no longer login with facebook. Trying to login simply brings me back to the login screen. I've checked to see if the methods (like loadUserByUsername) in my custom provider are being called but they are not. The constructor is though. All of the facebook parameters (secret, etc) are being passed correctly to the facebook php-sdk class.
Also, If the autologout link is set to try the facebook button always shows logout of facebook. Even when I click it, it just reloads the page with the same logout of facebook button. And I'm not logged into facebook at all. Very strange.
Thoughts?
I know that maybe this question is a bit stupid, but how can i convert retrived from Facebook date in string (for example: birthday) into Doctrine's Date
?
Follow the document, I got this :
InvalidConfigurationException: Invalid configuration for path "security.firewalls.public": The check_path "^/facebook/login_check$" for login method "fos_facebook" is not matched by the firewall pattern "^/facebook/.*".
public:
pattern: ^/facebook/.*
fos_facebook:
login_path: ^/facebook/login
check_path: ^/facebook/login_check$
default_target_path: /mobile
provider: my_fos_facebook_provider
anonymous: true
logout:
handlers: ["fos_facebook.logout_handler"]
Hello everyone,
I still have an issue with integrating this bundle and I'm sorry to bother you with my troubles.
I've followed the installation section of FOSFacebookBundle and I've done the Optional part to let it work with FOSUserBundle. By the way, FOSUserBundle is installed and configured.
Following the example now I have this error message:
Fatal error: Namespace declaration statement has to be the very first statement in the script in PathToTheProject\src\MyCorp\MyBundle\Security\User\Provider\FacebookProvider.php on line 3
of course the first three lines of the file are :
<?php
namespace Illustra\MainBundle\Security\User\Provider;
// etc.
I've tried to put this code into the config.yml and I still get this error message (but with the config.yml in the path). I've tried Google the error message, but nothing relevant.
is Anyone having a clue by reading this? Because I'm out of thing to try to solve this.
If you need anything to clarify this issue, just ask I will provide it to you. Thank you for your time.
I can't login when I user internet eplorer, an other page opens and is empty.
@lsmith77 could we tag the commit that works with the facebook php-sdk 2.x version? After looking into the problem it looks like the facebook javascript sdk / php sdk are simply not working together yet (with oauth 2). I've reverted back to commit d3dd35b and everything works great (with the php sdk 2).
I'd like to continue using the symfony deps file / install system though so a tag at that commit would be much appreciated so I can tag the FOSFacebookBundle at a commit that works with the 2.x SDK.
I'm having this error all over again. I've setuped this bundle:
fos_facebook:
file: %kernel.root_dir%/../vendor/facebook/src/base_facebook.php
alias: facebook
app_id: 2617310805505xx
secret: 6ee2fb69b86897df1379d7c3ac2xxxxx
cookie: true
permissions: [email, user_birthday, user_location]
in app.developers center is everything ok but when i click the facebook login button the pop up has:
http://www.facebook.com/login.php?return_session=1&nochrome=1&fbconnect=1&extern=0&display=popup&api_key=undefined&v=1.0 and rest get options.
Why de api_key there is undefined ?
Hi there
If i initialize the thing in my Twig template with {{ facebook_initialize({'xfbml': true}) }}, i get this error:
Fatal error: Call to undefined method Facebook::getSession() in /my/project/home/vendor/bundles/FOS/FacebookBundle/Templating/Helper/FacebookHelper.php on line 47
Can you help me? What's going wrong here?
Implemented the thing in a +- empty symfony 2 beta 3 project, with your README provided in your github package.
Thanks a lot
Chris
I don't know if anyone else has had this issue, but the fbml login button doesn't seem detect 'logged in' status correctly with autologoutlink: true. Meaning: regardless if I am logged into facebook or not, the fbml login button is always displayed in "log in"-state on initial page load.
However running FB.getLoginStatus seemed to automatically set the fbml-button to correct state. If this issue is repeating on others, it might be good to mention it in your documentation.
FB.getLoginStatus(function(response) {
if (response.authResponse) {
// Do something for logged in users
} else {
// User is not logged in to fb
}
});'
Hi,
I tried to use FacebookBundle in a app, i put all the default configuration but i change the security part like that:
security:
factories:
-"%kernel.root_dir%/../src/FOS/FacebookBundle/Resources/config/security_factories.xml"
providers:
fos_facebook:
id: fos_facebook.auth
firewalls:
only_facebook: # with facebook entry point (redirect to the facebook login url)
pattern: /.*
fos_facebook: true
access_control:
- { path: /.*, role: [ROLE_USER] }
According to the documentation, if an user is not logedin to the app, he will be redirected to the login url, but it's doesnt the case. I get an Access Denied exception
Anyone has an idea ?
Thanks a lot :)
is a new way to store and use the facebook csrf token
commit - https://github.com/facebook/php-sdk/commit/ab2d46df947d113d7c20fc46d8865a66168fcf05
I have kind of problem with bundle usage.
Client want to put ability to login using facebook directly on login account and add ability to attach users to their facebook accounts (so user with attached facebook can either use login/password or login using facebook)
Lets say user X have existing account on site with email ([email protected])
And he have facebook account with email ([email protected]).
If he will click on "Login using facebook" button - new account will be automatically created for him (because his old account is not linked to facebook and have working email in it), which is wrong.
IMHO right solution - add ability to show custom page, something like "Your facebook account is not linked to any website account. You can either create new account (link, when user click on it - new user created and facebook linked) or login with your old account and link it to facebook (login link, user login using email/password and after that got ability to link account to facebook)
Also I am not sure, if current bundle version have ability to link already logged in user with his facebook account.
What do you think?
Hi,
I was wondering if it would be possible to have a documentation to use both fosuserbundle and fosfacebook bundle to authenticate with the same rule (and pattern) in the firewalls?
I know a lot of people have tried to do it, as I am now but no one seem to have figured it out and share it.
Thanks by advance,
Erwan
Hi,
As soon as I logged in, my website becomes really slow to load pages, I used firebug to find out why, and it seems, at every page loading, it take seconds to check out the cookie created by the bundle.
fbrs_(fb_id)...
Does anyone happen to have this problem? Or know why this would happen?
Hi there,
I think there's an error in the refreshUser method in the FacebookProvider class, I was getting an error telling me that I had no user provider:
There is no user provider for user "Mysite\SiteBundle\Document\User"
But I found out after dumping the User object, it was that the refreshUser method was trying to get the facebookId but the User object didn't have one it only had the username at this point (not sure why). I modified the method to use $user->getUsername() instead of $user->getFacebookId() and is working now.
Also I noticed that the example User class have getFacebookID() instead of getFacebookId() which is called in this method.
Method from the example FacebookProvider:
public function refreshUser(UserInterface $user)
{
if (!$this->supportsClass(get_class($user)) || !$user->getFacebookId()) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user)));
}
return $this->loadUserByUsername($user->getFacebookId());
}
Modified method:
public function refreshUser(UserInterface $user)
{
if (!$this->supportsClass(get_class($user)) || !$user->getUsername()) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user)));
}
return $this->loadUserByUsername($user->getUsername());
}
Thanks,
Carlos
The Symfony 2.1 branch makes the ProfilerListener a subscribe to the kernel.request
event. This means that the ProfilerListener is instantiated very early when all the kernel.request
listeners are being prepared (in ContainerAwareEventDispatcher::lazyLoad
). This means it's instantiated before any listeners on that event, including the listeners that start the session.
The problem is that the ProfilerListener's instantiation ultimately means that the FacebookSessionPersistence
class is instantiated, causing the session to be started before it's intended to be started.
This doesn't seem to cause an outward problem when developing (the session is started a little earler), but it does seem to break session storage in the test environment, because the following happens:
FacebookSessionPersistence
is instantiated before dispatching kernel.request
. This starts the session, and session_id()
is generated to a real value.
TestSessionStorage
sees no cookie (since this is the first request) and sets the session_id to an empty string (https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php#L56)
The normal SessionListener
is called, which calls Session::start()
. This would normally generate the session_id() (since it's blank), but since the session is already started, start
does nothing and session_id stays blank.
When session persistence kicks (https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php#L78), the session_id is blank. The session is saved, but under the "key" of a blank session_id().
On the next request when the session is loading, a brand new session_id is generated once again because the session_id is blank. Session storage does a lookup with this id, which of course brings nothing back. This looks like a new session and the cycle repeats.
The easiest solution would be to remove the session start from FacebookSessionPersistence, but I'm sure that has other consequences.
Ideas on the best way to solve this? Can we remove the session start from the above class?
Thanks!
Hi,
When clicking the login button it is only asking permission to access basic user info ignoring all the other permissions, this was working before so I'm not sure if this is a problem with javascript SDK.
This is code of my button:
<fb:login-button scope="email,user_birthday,user_location,offline_access,user_checkins,friends_checkins" autologoutlink="1"></fb:login-button>
Hi,
I am just reading the source code of the bundle for testing purpose.
I am wondering if the P3P headers should not been inserted ?
Thanks in advance
Regards
Antoine Tissier
I have setup FOSFacebook to work alongside FOSUserbundle. That by itself works. Unfortunately, I noticed that the "Remember me" functionality seems to be broken now.
I have the following setup:
security:
factories:
- "%kernel.root_dir%/../vendor/bundles/FOS/FacebookBundle/Resources/config/security_factories.xml"
providers:
fos_userbundle:
id: fos_user.user_manager
mybundle_fos_facebook_provider:
id: mybundle.facebook.user
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
logout:
delete_cookies:
fbsr_%fb_app_id%: { path: null, domain: null }
anonymous: ~
#fos_facebook:
# app_url: "%fb_app_url%"
# server_url: "%fb_server_url%"
# check_path: /fb_login_check
# provider: mybundle_fos_facebook_provider
remember_me:
key: aSecretKey
lifetime: 3600
path: /
domain: ~
role_hierarchy:
ROLE_ADMIN: ROLE_USER
With this configuration, "remember me" works, if I uncomment the fos_facebook section, it does not. To be precise, the REMEMBERME cookie is created, but gets deleted when I open the browser again.
Any ideas why this might be the case?
Hello
I am not sure if i have a compatibility problem between these two? SecurityBundle and FosFacebookBundle
I get this error just enabling the FosFacebookBundle
Call to undefined method Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension::addSecurityListenerFactory()
in ...vendor/bundles/FOS/FacebookBundle/FOSFacebookBundle.php on line 25
Thanks for any ideas
I performed all the necessary changes after the change to the facebook sdk3.
Everything worked before, but after the upgrade I can no longer login with facebook. Trying to login simply brings me back to the login screen. I've checked to see if the methods (like loadUserByUsername) in my custom provider are being called but they are not. The constructor is though. All of the facebook parameters (secret, etc) are being passed correctly to the facebook php-sdk class.
Also, If the autologout link is set to try the facebook button always shows logout of facebook. Even when I click it, it just reloads the page with the same logout of facebook button. And I'm not logged into facebook at all. Very strange.
Thoughts?
Hi there!
I have inserted some heavy debug code, to figure out whether the method gets called (since no DB record is created after login)
public function loadUserByUsername($username) { print_r("loadUserByUsername called!"); die(); ...
The debug code is never executed.
The provider service is configured, and the class is in the right place.
Any hints?
BR Stephan
the docs say that fos_facebook.file is optional but I get errors when it's not set.
setting it without including the facebook.php file in autoload.php makes error "class BaseFacebook not found in FacebookBundle/Facebook/FacebookSessionPersistence.php".
if I include facebook.php, I get the error "Cannot redeclare class FacebookApiException"
FOSFacebookBundle provide a way to do a authenticate user using Facebook.
This is done by many steps define on README :
Note that logging in a user requires multiple steps:
For step 1. and 2. there are two options:
This module doesn't provide any method to authenticate a FBUser is the user have already a FBToken & a FBUserId.
Do you think that it could be a good thing if the FOSFacebookBundle provide a way to authenticate a FBUser using HTTP Header to pass FBToken & FBUserId ?
I have already build my own Bundle to do that. I'm wondering if it could be accept if I do a pull-request for this ?
There is a small bug in FOS\FacebookBundle\Security\Logout\FacebookHandler:
$fb_cookie = sprintf(
'fbsr_%d',
$this->facebookApi->getAppId()
);
This doesn't work right. For my appId: 208621755871551 returns fbsr_2147483647. Replacing %d with %s will fix it.
Hi everyone,
I am trying to install FOSFacebookBundle but once I install via github the bundle, I got this message on my webpage:
Call to undefined method Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension::addSecurityListenerFactory() in MyWebAppPath\vendor\bundles\FOS\FacebookBundle\FOSFacebookBundle.php on line 25
Someone has an idea???
Thank's everyone
Fosfacebook bundle is working perfect with facebook login but when I secure a path with access control, going to that path redirects to facebook application page instead showing /login page
Hi ! I'm brand new here... I've done everything it is written to set up the FOSFacebookBundle.
but when cleaning the cache, I receive this:
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException] Invalid configuration for path "security.firewalls.public": The check_path "^/login_check$" for login method "fos_facebook" is not matched by the firewall pattern "^/.*".
[LogicException]
The check_path "^/login_check$" for login method "fos_facebook" is not matched by the firewall pattern "^/.*".
So I put a # before security.firewalls.public pattern "^/.* in the security.yml
But I got this when cleaning the cache:
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException] The service "my.facebook.user" has a dependency on a non-existent service "fos_user.user_manager".
And I got this when trying to access to any page:
Whoops, looks like something went wrong.
1/1 ServiceNotFoundException: The service "my.facebook.user" has a dependency on a non-existent service "fos_user.user_manager".
in PATH\OF\MY\PROJECT\vendor\symfony\src\Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass.php line 59
at CheckExceptionOnInvalidReferenceBehaviorPass->processReferences() in PATH\OF\MY\PROJECT\vendor\symfony\src\Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass.php line 43
at CheckExceptionOnInvalidReferenceBehaviorPass->processDefinition() in PATH\OF\MY\PROJECT\vendor\symfony\src\Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass.php line 37
at CheckExceptionOnInvalidReferenceBehaviorPass->process() in PATH\OF\MY\PROJECT\vendor\symfony\src\Symfony\Component\DependencyInjection\Compiler\Compiler.php line 119
at Compiler->compile() in PATH\OF\MY\PROJECT\vendor\symfony\src\Symfony\Component\DependencyInjection\ContainerBuilder.php line 436
at ContainerBuilder->compile() in PATH\OF\MY\PROJECT\app\bootstrap.php.cache line 868
at Kernel->buildContainer() in PATH\OF\MY\PROJECT\app\bootstrap.php.cache line 779
at Kernel->initializeContainer() in PATH\OF\MY\PROJECT\app\bootstrap.php.cache line 513
at Kernel->boot() in PATH\OF\MY\PROJECT\app\bootstrap.php.cache line 544
at Kernel->handle() in PATH\OF\MY\PROJECT\web\app_dev.php line 20
Hi,
I'm using the master version of FOSFacebookBundle and FOSUserBundle.
I keep on having errors like :
Call to undefined method Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension::addSecurityListenerFactory() in MyWebAppPath\vendor\bundles\FOS\FacebookBundle\FOSFacebookBundle.php on line 25
or
Warning: require_once(C:\wamp\www\appName\app/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\appName\app\autoload.php on line 26
Fatal error: require_once() [function.require]: Failed opening required 'C:\wamp\www\appName\app/../vendor/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php' (include_path='.;C:\php\pear') in C:\wamp\www\appName\app\autoload.php on line 26
I don't know if my errors are comming from my symfony version but i would like to be sure :
Which Symfony2 version should I use ? Which exact tag ?
Thank you, bye!
Recently i update all my vendors and i got this error:
Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension' does not have a method 'addSecurityListenerFactory' in /Applications/MAMP/htdocs/sbaam/vendor/bundles/JMS/SecurityExtraBundle/DependencyInjection/SecurityExtension.php line 86
I needed to disable the bundle (and comment its configuration on my config files) to continue the development. I hope a solution to come soon...
As lined on StackOverflow [1], a parameter "fileUpload" has to be set to true, to enable fileUploads.
As far as I see this is not implemented yet.
Can anybody confirm, that this bundle works well using chrome (or chromium)? My implementation is little bit different because of using FosUserBundle. It's strange, because everything works great on firefox, opera and konqueror. Chromium's errors returned by the bundle:
The Facebook user could not be retrieved from the session.
Chrome's javascript console:
http://paste.org/43694
Firewall configuration:
firewalls:
public:
pattern: ^/
openid: true
form_login:
provider: fos_userbundle
login_path: /login
always_use_default_target_path: true
default_target_path: /login
fos_facebook:
login_path: /login
check_path: /facebook/login_check
default_target_path: /login
provider: my_fos_facebook_provider
logout:
target: /login
anonymous: ~
js login action:
http://paste.org/43693
If you think it's fosfacebook+fosuser issue and not ony fosfacebook, just close it.
Due to this error I've switched to php-sdk.
Hi,
I think we need to add a new RedirectResponse for this bundle.
Facebook does not take care of http redirect, we need to redirect with javascript if we are in a Facebook context (ie Facebook Apps)
Here is the code :
https://gist.github.com/863839
What do you think ? :)
Hi,
I got a problem when my session expired or I logout without using the facebook button but just the redirection path to:
{{ path('_security_logout') }}
What happen when I want to login after one of this cases is:
I click on login, and get login "automatically" without the windows asking me my facebook credential. But the only thing that I can see happening is that the facebook button display change to logout, but I am not actually login. If i refresh the page, it changes back to login.
What I need to do to login, is to click on the facebook logout button and then click back once it changes to login, and then I get asked my facebook credential and I get logged in (for real).
My questions are, Is there anyway to correct or avoid this problem? Is there anyway to properly logout of facebook without using the facebook logout button?
Thanks.
Not sure if this is an issue with my code or not, but it worked up until the FOSFacebookBundle was upgraded to use v3 of the SDK.... See https://gist.github.com/1092555 for my security.yml and excerpt from my controller. Essentially the user clicks a link to eg www.example.com/signin/facebook
which bounces them to a page requiring the ROLE_FACEBOOK
role. This triggers the Facebook authentication and I get the signin page as expected.
However, when I sign in, this now goes back to my app but as the authentication in Symfony2 hasn't taken place yet, the user is then bounced back to Facebook and subsequently back to my app etc, resulting in an infinite redirect. This wasn't happening with v2.1.2 of the Facebook SDK, and I've updated both the FOSFacebookBundle and Facebook SDK accordingly.
Is there a step missing from the install docs which is relevant to v3? I've applied the config as per the installation, but still no dice.
In authenticate method even PDOExceptions are catched and never displayed or logged.
This hurts debugging a lot.
I found some unclear or wrong bits in the docs:
So, I'm not sure if this is an issue with the FacebookBundle or not... :-) The Facebook API checks for the HTTP_HOST
and REQUEST_URI
keys in the $_SERVER
array, when the API's getLoginUrl()
method is called. These keys aren't present when eg tests are carried out from the command line (I'm using Behat for testing).
Possible solution is presented here: http://stackoverflow.com/questions/5966186/how-to-set-http-host-for-webtestcases-in-symfony2/5975908#5975908
which would need to be done in the start()
method in the entry point. This feels slightly hacky, but at the moment I can't think of a neater way...
RememeberMe has two user providers (from UserBundle and FacebookBundle), it takes first so FacebookProvider is used and user is never found by is username. I've just added
Maybe I'm doing something wrong in configuration.
Not elegant way to deal with it:
public function loadUserByUsername($username)
{
// try to load by username
// dirty hack for remember me filter which uses same provider
$user = $this->userManager->findUserBy(array('username' => $username));
Hi, I'm reporting this as an issue allthough I've seen the comments to the commit.
This issue manifests itself with the following error:
PHP Fatal error: Call to undefined method Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension::addSecurityListenerFactory() in .../vendor/bundles/FOS/FacebookBundle/FOSFacebookBundle.php on line 25
Current workaround:
in deps.lock, add:
FOSFacebookBundle b3bfbfc2898d62ccb3ec697cafe32f374928d49c
and run bin/vendors install
Hi, I have a problem with admin and users and I got confused with all that. I've already installed sonata admin(with fos user) and there everything works fine.
But i have a problem with facebook bundle on frontend.
My website: http://sgnx.lh.pl/web/app_dev.php
When i click the login button and fill the facebook requirements the button is changing to logout, but when i change the page it changes back to login again.
I think there is a problem with my configuration ;/
Below i present my configuration.
My security:
security:
providers:
my_fos_facebook_provider:
id: my.facebook.user
fos_userbundle:
id: fos_user.user_manager
encoders:
"FOS\UserBundle\Model\UserInterface": sha512
firewalls:
admin:
switch_user: true
context: user
pattern: /admin(.*)
form_login:
provider: fos_userbundle
login_path: /admin/login
use_forward: false
check_path: /admin/login_check
failure_path: null
use_referer: true
default_target_path: /admin/dashboard
logout:
path: /admin/logout
target: /admin/login
anonymous: true
public:
# since anonymous is allowed users will not be forced to login
pattern: .*
fos_facebook:
app_url: "http://apps.facebook.com/krakowforfun/"
server_url: "http://localhost/facebookApp/"
login_path: ^/login
check_path: ^/login_check
default_target_path: /
provider: my_fos_facebook_provider
anonymous: true
logout:
handlers: ["fos_facebook.logout_handler"]
main:
pattern: .*
form_login:
provider: fos_userbundle
login_path: /login
use_forward: false
check_path: /login_check
failure_path: null
logout: true
anonymous: true
access_control:
# URL of FOSUserBundle which need to be available to anonymous users
- { path: ^/_wdt, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/_profiler, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
# -> custom access control for the admin area of the URL
- { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/login-check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
# -> end
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
# Secured part of the site
# This config requires being logged for the whole site and having the admin role for the admin part.
# Change these rules to adapt them to your needs
- { path: ^/secured/.*, role: [IS_AUTHENTICATED_FULLY] }
- { path: ^/admin, role: [ROLE_ADMIN, ROLE_SONATA_ADMIN] }
- { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_SONATA_ADMIN, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
SONATA:
- ROLE_SONATA_PAGE_ADMIN_PAGE_EDIT
acl:
connection: default
my config:
fos_user:
db_driver: orm
firewall_name: main
user_class: Acme\UserBundle\Entity\User
fos_facebook:
file: %kernel.root_dir%/../vendor/facebook/src/base_facebook.php
alias: facebook
app_id: "here is my id"
secret: "here is my secret"
cookie: true
permissions: [email, user_birthday, user_location]
my routing:
fos_user_security:
resource: "@FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "@FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /profile
fos_user_register:
resource: "@FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /register
fos_user_resetting:
resource: "@FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
fos_user_change_password:
resource: "@FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /profile
_security_check:
pattern: /login_check
_security_logout:
pattern: /logout
_facebook_secured:
pattern: /secured/
defaults: { _controller: AcmeDemoBundle:News:index }
If anyone can help me i will appreciate it.
License headers should be updated according to FriendsOfSymfony/friendsofsymfony.github.io#14
Following README instructions, at #6, I get this exception:
InvalidConfigurationException: Unrecognized options "fos_facebook" under "security.firewalls.public"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.