Before trying to merge multiple social accounts in a single one, let's add one more option for users to log in. This time with google. This will be easiest so far because everything is prepared in the previous tutorials. Thing that will explain is how to get
client_secret for our configuration.
On this page you can find instructions. I will try to simplify this.
Open Developers Console and create New Project.
Type app name
Wait few seconds for app to be ready. Then expand left menu and click on API Manager.
Select Credentials submenu and then chose OAuth consent screen tab.
Fill in Product name shown to users field and save.
Click New credentials and OAuth client ID.
Now we will define our client as a client. Fill in name. We will authorize our development url which is
http://localhost:8000 and we will use like before callback route with google parameter:
One more thing before proceeding. We need to enable Google+ API. Click on the Overview tab on the left side then Google+ API. On the new page click Enable API.
And finally, we have credentials. We can build configuration for Socialite package. Copy configuration in the
'google' => [ 'client_id' => '716438745047-ua94i3snt6s01i0ncn3u33j5h5rvu9rk.apps.googleusercontent.com', 'client_secret' => '23zeZz1ya9syFMH4ggQM2e-p', 'redirect' => 'http://localhost:8000/callback/google', ],
Add link in the
<a href="redirect/google">G+</a>. Now when user clicks on the link it will be redirected to the google's page an asked for permission. After that user will be redirected to our app and successfully logged in.
Occasionally it happens that google require some time to apply client configuration If you get an error message redirect_uri_missmatch wait couple of minutes and it should work normally.