Week 4 : GSoC 17 First Social Auth Implementer

Submitted by hudixt on Wed, 07/05/2017 - 20:42
Google Summer Of Code 2017

I am working on Adding support for The league oAuth and new implementers for social auth and social post under the mentorship of Getulio Sánchez "gvso" (Paraguay) and Daniel Harris “dahacouk” (UK).

In the last week, we worked on using SocialAuth setting up SocialAuthUserManager to use Entity in the authentication process and Create SocialPostManager.php to use SocialPost Entities. Apart from that, we implemented the encryption and decryption methods to keep the token secured in the database. This week I worked on implementing the first social_auth implementer.

Here are some of the things that I worked on during the 4th week of GSoC coding period.

Adding the data fields record to the social_auth entity - A new field user_data was added to in the social_auth entity which will contain the data to be further used, the methods to read and write user_data from the entity table.

Creating the first social_auth implementer - The first social_auth implementer I choose to implement is social_auth_facbook. We’ll be using Facebook Provider for OAuth 2.0 Client.

  • Checking The Facebook Provider in the social_auth plugin: as we’ll extend the league oAuth client by using Facebook provider we need to make sure that the library is installed. All this third party library requires Theleague oAuth as the base, thus we’re also checking for the league oAuth in the social_auth module.

  • New field in social_auth_facebook settings form page: As we’ll collect data for the further use, the site administrator can define which data points can be collected from the user.

  • Creating Instance of \League\OAuth2\Client\Provider\Facebook class.

  • Refactoring the code - We did not require many of the functions present in the current social_auth_facebook, thus the methods such as checking the HTTP library are removed.

  • Getting an authorization url :-    $authUrl = $provider->getAuthorizationUrl([
           'scope' => ['email', '...', '...'],

  • Getting an access token : -  $token = $provider->getAccessToken('authorization_code', [
       'code' => $_GET['code']

  • Retrieving user _details -
       $user = $provider->getResourceOwner($token);

These were some of the important topics related to my project that I had to work on during my fourth week. I was thrilled by the fourth week of Google Summer Of Code coding phase. My goal for the next week to get 4 out of Paypal, Vimeo, Disqus, Facebook, Google Instagram and start working on one more. At this point, I’m on my track according to the proposal but slightly lagging behind on next milestone promised previous week, although I’ll try to complete social_auth_facebook by Friday [Link to Current Repo].