Search code examples
authenticationfosuserbundlesymfonyhwioauthbundlefosoauthserverbundle

Symfony3 FOSOAuthServerBundle and Facebook or Google login


I have created an API that uses the FOSUserBundle and the FOSOAuthServerBundle for user accounts and Authorization.

Is it possible to add, login via facebook or google, functionality using the FOSOAuthServerBundle?

I have seen people mentioning the HWIOAuthBundle as a way to integrate Facebook and other social logins. I have not seen an example of integrating the two bundles (FOSOAuthServer and HWIOAuth) so that users can create accounts on the system and authenticate (FOS) while at the same time being able to create accounts / login via FB (HWIO).


Solution

  • I found this post about using custom grant types with FOSOAuthBundle:

    http://blog.tankist.de/blog/2013/08/20/oauth2-explained-part-4-implementing-custom-grant-type-symfony2-fosoauthserverbundle/

    The idea is to create a service that takes the facebook token and validates it with facebook. If successful an OAuth Token should be returned.

    The HWIOBundle is not necessary