Social Login System

Scripts has in-built social login system. In below tutorial, we will show you how to use social login system :-

Facebook Login :-

  1. Open Facebook page for developers.
  2. Hover over My Apps and click on Add a New App and select Website.
  3. Enter the app name. On the next step select the category and click Create App ID
  4. When you get to the next step, select Skip Quick Start because it is showing instructions of how to login users with JavaScript SDK. We are not using Javascript SDK, so we can skip it.
  5. On the app dashboard you will see all important data that we need like API Key  and  Secret Token.
  6. Make sure you go to settings and set your APP live.
  7. Now, Open "config/services.php" file in script.
  8. Update the App ID and Secret token, also update your domain
'facebook' => [
    'client_id' => 'APP_ID_here',
    'client_secret' => 'Secret_Token_Here',
    'redirect' => 'http://youdomain.com/callback/facebook',
],

Note: "callback/facebook", should remain as it is after your URL.

Twitter Login

  1. Like with facebook, you need to use twitter panel for developers where you need to create the app. Go to the Twitter Apps page, and click Create New App.
  2. Enter the application name and description. Wor website use http://your-domain.com or any other fully qualified url that can pass validation. For production you can put your real website address. For development we will use placeholder address.
  3. Click on the Keys and Access Tokens tab.
  4. Copy Consumer Key (API Key) to client_id, Consumer Secret (API Secret) to client_secret.
  5. And finally, we have credentials. Copy configuration in the config/services.php. :-
'twitter' => [
    'client_id' => 'client_id_here',
    'client_secret' => 'client_secret_token_here',
    'redirect' => 'http://your_domain.com/callback/twitter',
],

Note: "callback/twitter", should remain as it is after your URL.

Google Login

  1. On this page you can find instructions. I will try to simplify this. Open Developers Console and create New Project.
  2. Type app name
  3. Wait few seconds for app to be ready. Then expand left menu and click on API Manager.
  4. Select Credentials submenu and then chose OAuth consent screen tab.
  5. Fill in Product name shown to users field and save.
  6. Click New credentials and OAuth client ID.
  7. Now we will define our client as a client. Fill in name. We will authorize our development url which is http://your-domain.com and we will use like before callback route with googleparameter:  http://your-domain.com/callback/google.
  8. One more thing before proceeding. We need to enable Google+ API. Click on the Overviewtab on the left side then Google+ API.
  9. On the new page click Enable API.
  10. And finally, we have credentials.  Copy configuration in the config/services.php.
'google' => [
    'client_id' => 'Client ID here',
    'client_secret' => 'Client secret here',
    'redirect' => 'http://placeholder.com/callback/google',
],

Note: "callback/google", should remain as it is after your URL.

That's it and you are done.


Loading ...

Related Results :

  1. Social Login System
Note :
  • Related Posts are generally User Blog posts.
  • or Other tutorials from other networks of w3clan.com.
  • Any registered user can create related posts based on search term tags.

About the Author