# Social Authentication
# Introduction
In addition to the default authentication, Bagisto also provide a convenient way to authenticate with multiple OAuth providers.
The following social networks are provided out of the box: Facebook (opens new window) GitHub (opens new window) Google (opens new window) LinkedIn (opens new window) and Twitter (opens new window)
Once you configured one of the social networks, your customers can authenticate by one of these social networks by just a single buttons, there is no need to fill various fields.
# Configuration
To get started, you need to enable this feature first in the admin interface, navigate to configure>>Customer>>Social login. Here you can enable / disable social authentication providers as shown in the below image.
# Configuring Github
# Register a new OAuth application
Before you can allow you customers to authenticate with Github, you first need to create a GitHub application (opens new window).
Authorization callback URL
You can find the Authorization callback URL inside the .env file and change yourhost.com with your domain name.
Once your new OAuth Application is registered, click on the name of your new application to get the Client ID and Client Secret.
# Configure credentials for the OAuth application
Now that you have the Github Client ID, Client Secret and Authorization callback URL, you just need to add these to your .env file.
Remember to change the GITHUB_CALLBACK_URL yourhost.com with your domain name.
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_CALLBACK_URL=https://yourhost.com/customer/social-login/github/callback
# Configuring Google
# Register a new OAuth application
Before you can allow you customers to authenticate with Google, you first need to create a Google application (opens new window).
- Go to your API & Services ->Library
- Now click on Google+API under the section Social.
- Now, click the Enable button to enable the Google+ API.
- Now, click My Project to create a new project.
- On clicking My Project, a pop-up will appear. Click “New Project” link.
- Enter the name for your store so that you can identify your project. Please note that you should not include any Google word for your project name.
- Meanwhile, go to the Credentials menu option and then click on Create credentials.
- After that, click on OAuth client ID.
- Select the Application type and enter the Authorized JavaScript origins and the Authorized redirect URLs, once that is done click the Create button.
OAuth Redirect URL
Set the OAuth Redirect URL like this: www.example.com/socialsignup/google/callback/
10. After clicking the Create button in the above step you will get the Client Id and Client Secret.
# Configure credentials for the OAuth application
Now that you have the Google Client ID, Client Secret and Authorization callback URL, you just need to add these to your .env file.
Remember to change the GOOGLE_CALLBACK_UR yourhost.com with your domain name.
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_CALLBACK_URL=https://yourhost.com/customer/social-login/google/callback