oauth-2.0fbconnectsymfony-2.5

Login with facebook or google using Oauth2 library in symfony2


I am using fosuserbundle for login and registration in my symfony 2.6 project. Now I want to allow user to login via facebook or google account.

I want to use Oauth2 library of friendsofsymfony getting from here https://packagist.org/packages/friendsofsymfony/oauth2-php

I have installed library using "friendsofsymfony/oauth2-php": "1.1.*@dev" in composer.phar and updated vendors. But I am not able to find out the documentation which can show the steps to configure and use in login.

It should work with fosuserbundle. Can anyone suggest me where can I get steps how can I use Oauth2 library in my project?


Solution

  • You can use HWIOAuthBundle to enable login with facebook or google and many more social networks. Here is a tutorial on how to setup this bundle in your application : https://gist.github.com/danvbe/4476697

    Also if you use this bundle you should check my gist : https://gist.github.com/antoinemineau/8836621#file-fosubuserprovider-php-L47, i added an if statement which prevents the code to be executed if the api are not responding as expected.