Social login is one of the best options that you can use on your site to allow people to register. Laravel is another tool that is used to build websites all over the world. However, if you were to integrate social login to a Laravel application then things are going to be a little different. Here you are going to learn how you can set up Google and Facebook to add social login to your Laravel application. In this way, your users will be able to log into the website using their Facebook or Google ID. Strompath Laravel integration is simple in the sense that it automatically goes through your application and checks for the social providers that you have already created. Then it will display the correct login button on the webpage.
Facebook Social Login
To allow people to log in to your website through Facebook, there are a few simple steps that you need to follow.
First and foremost you will need to create a Facebook application which you can do from the Facebook Developer Site. Click create a new App and enter the name of your application, after you have entered the necessary information, you should click create app ID.
Next, you need to tell Facebook what URLs you will be using. To do this click on settings from the dashboard and go to Add Platform. Here, select the Website option, if you wish to add more URLs then you can just repeat this process as many times as you wish. Once you are satisfied with the URLs that you provided you should click the save changes button.
The next thing that you need to do is create a Facebook directory in Stormpath. Here you will need to enter the Facebook app credentials into the Stormpath Directory. In this way, you will give Stormpath the permission to interact with the Facebook API which is helpful when you are trying to automate OAuth flows. To do all of this, you will need to visit the Stormpath Admin Console Directories. Here, click the Create Directory button and choose the Facebook option. Then you will need to enter a name and also enter your Facebook App ID, then just click the create button and you will be good to go.
Then you will need to connect your Facebook directory to your Stormpath Application. For this, you need to visit the Stormpath Admin Console and navigate to applications and select the application of your choosing. Then on the application page click the account stores tab and go to add account store. You will get a drop down menu where you can select the new Facebook directory that you created. Once everything is done, click the save button.
You can add different callbacks in the Stormpath Laravel configuration file too, but this is totally an option. For this you will need to go to the config/stormpath.php file and go to the social option. You will then find a Facebook section where you will find a list of scopes.
Google Social Login
Facebook is not the only option because you can integrate a Google login too and the process is very similar to Facebook. Firstly, you need to go to the Google Developer console to create an application. Click on the create project button and you will see a new window where you will be required to enter your project or application name. After you have filled out all the boxes, click on the create button. Once the application has been created, you will be taken to the dashboard of your application. The next thing that you need to do is enable the correct API so that users may login. For this click on the Use Google APIs button which will show you a list of available APIs. You need to find social APIs where you will find the Google+ API, then just click the enable button.
Once you have enable the correct API, you need to create credentials for your Google Application. For this you will see the credentials option on the left side of the screen. Just click on create credentials and then on the OAuth client ID. Click on the configure consent screen and a new window will open. Here the only field that you need to be worried about is product name. The product name is what the users are going to see after they click on the Google button. Then don’t forget to click the save button otherwise all of your progress will be lost.
Next click on the web application button where you will need to enter the correct redirect URLs. In the authorized URL field you will need enter the right URL and then click the create button. Upon clicking you will be provided with your OAuth client ID. Then you need to create a Google directory in Stormpath. This will allow Stormpath to interact with the Google API. The process is very similar to what you did with the Facebook directory, the only major difference being that you will also need to insert your Google Redirect URL. Make sure that you click the create directory button on the bottom of the page.
Next you will need to connect your Google directory to this Stormpath Application. To do this you will need to visit the Stormpath Admin Console and then navigate to the applications section, then just select your application from the list.
If you have a Shopify website or are thinking about building one, then make sure that you use social login Shopify apps. This is because this technique has made websites more profitable. A lot of users out there just stop using a website when they are required to fill out a registration form. No one likes doing it and that is why people opt out. However, when your Shopify website has the option to login using social media accounts, then users don’t find it tedious since it only takes a couple of seconds. Social logins help increase conversion rates.