Majority of web sites use sign-up with social networks as alternate for traditional registration/login. Buttons “Login with: Facebook, Twitter, Google,... ” are present together with a login form very often now.
Using social networks for login simplifies a user experience and saves his time.
The author used social login on different web sites as well. Based on experience it was decided to build a PHP class/package that summarise the social login process on an abstract level and allows to implement the process with minimum coding.
Social login in common
For a user a social login looks like identical process in different social networks. Usually, it looks like: a user licks on a “login with ...” button. Is redirected to a social network website (http://facebook.com etc.) , clicks “Allow” on that site and, finally, is redirected back to an original website where his social login is processes and a session for a user is created.
However, on a back-end there is some difference.
Some social networks APIs don't need to connect to an api endpoint before to redirect a user a login page. Other has to connect to an API to init a login process, to get some special redirect url, to check some settings etc.
Next difference is that some APIs will require saving a specific data (request token etc) between 2 steps of an auth process – get a redirect url and complete login. For others no need to save something.
All such differences must be taken into account during a social login process.
Introduction gelembjuk/auth PHP package to unify the social login process.
The package is available in Composer. It allows to login with Facebook, Twitter, Google, LinkedIn with unified process and minimum coding. Additionally, the package can be easy extended with new social networks and same process will be used.
It is just normal installation with Composer