Connect to multiple social inputs in the HWIOauthBundle

I try to organize the possibility of entering a social network (initially LinkedIn, but it can be any other or self-generated from FosUserBundle), and then adding new connections to the same user via Twitter, FB, Github, etc.

The difficulty is connecting multiple accounts to FosUser and HWIOauthBundles. In order to collect as much data as possible and be able to easily add additional connections to services, I would really like each new connection to be recorded as one-to-many. IE: the initial login with LinkedIn creates a FosUser record and a new row in the socialLogin table, the next one (for example, a Twitter login) adds a new row to the socialLogin table that refers to fosUser.id.

How can I use the current user (Fos) as part of the new entry that HWIOauth will generate? The end result will be that he will be able to log in with any known user in order to log into the same account.

+4
source share
2 answers

The solution is actually easy. Check Symfony2 first : how to log in using OAuth (HWIOAuthBundle) + custom roles (default and loaded from the database) , which is an excellent guide for HwiOAuthBundle, then scroll down and look carefully at the publicus section loadUserByOAuthUserResponse () {... }.

. , , ( ). , . , ( twitter, a/c) .

, , /- ( ), Twitter, . ( , )

,

+1

social_data, - FOSUBUserProvider.php, , , , FOSUserBundle HWIOAuthBundle, .

, , .

0

All Articles