Sign in with google+ and facebook login in sign page of bagisto ecommerce
-
Hi, can anyone tell me about sign in with google+ and facebook login in sign page of bagisto ecommerce, I have tried with google+ but I am getting like this (404 The Page you are looking for does not exist or have been moved. Navigate using sidemenu.), Please If you have source code then send it to me,Thank You.
config/app.php
I have added Laravel\Socialite\SocialiteServiceProvider::class, in providers and 'Socialite' => Laravel\Socialite\Facades\Socialite::class, in aliases
pakages/Webkul/Shop/src/Http/routes.php
Route::get('login/google', 'Webkul\Customer\Http\Controllers\SessionController@redirectToProvider');
Route::get('login/google/callback', 'Webkul\Customer\Http\Controllers\SessionController@handleProviderCallback');SessionController.php (I have added below two methods)
public function redirectToProvider()
{
return Socialite::driver('google')->redirect();
}/** * Obtain the user information from GitHub. * * @return \Illuminate\Http\Response */ public function handleProviderCallback() { $user = Socialite::driver('google')->user(); return $user->token; }
In pakages/Webkul/Shop/src/Resources/views/customers/session/index.blade.php
<a href="http://localhost/vayathi/login/google">Login in with Google+</a>
config/services.php
'google' => [ 'client_id' => '947267311128-oaohbld4bfs3uph6oavkleotd45rmhe3.apps.googleusercontent.com', // Your GitHub Client ID 'client_secret' => 'L8GXzQHkoQYAtDEQPo-lFe6N', // Your GitHub Client Secret 'redirect' => 'http://localhost/vayathi/login/google/callback',
],
-
Hi,
Your route is as -
Route::get('login/google', 'Webkul\Customer\Http\Controllers\SessionController@redirectToProvider');
Route::get('login/google/callback', 'Webkul\Customer\Http\Controllers\SessionController@handleProviderCallback');
but redirect is -
'redirect' => 'http://localhost/vayathi/login/google/callback',
but it should be - 'redirect' => 'http://localhost/login/google/callback',
link is given -
<a href="http://localhost/vayathi/login/google">Login in with Google+</a>
but it should be, according to route -
<a href="http://localhost/login/google">Login in with Google+</a>
& Make sure your redirect url given during OAuth client ID creation ( https://prnt.sc/oe1th1)
For More reference follow this link to implement it - https://medium.com/employbl/add-login-with-google-to-your-laravel-app-d2205f01b895
Thanks
-
Hi,
If anyone created sign in with google+ or facebook then please send me the source code.
Actually I have created redirectToProvider() method and handleProviderCallback() method in SessionController, is it correct or not, I don't know. And I have created routes in pakages/Webkul/Shop/src/Http/routes.php
My project root URL is http://localhost/vayathi
Please any one can suggest me. Thank You.
-
Hi,
You can clone from this repository in which we have implemented socialite in bagisto.
link - https://github.com/rahulshukla-webkul/bagisto-socialiteThanks
-
Hi,
Thank you so much, now login with google+ is working fine. It shows users token, so now I need to redirect this to any other page instead of showing user token or user name etc.
-
Hi,
You can use it according to your need & don't use given google (client_id, client_secret) credentials, because we are going to delete this one.
Thanks
-
Hi,
I have created google (client_id, client_secret) credentials in my machine. I have tried with return redirect()->route('customer.session.index'); but not working.
-
Hi,
I am not getting you, can you elaborate more.
Thanks
-
Hi,
Can you give any example to redirect to any other page after login with google+
public function handleProviderCallback()
{
$user = Socialite::driver('google')->user();**return $user->name;** }
-
Hi,
What is happening ?
-
Hi,
It is showing only user name but I need redirect to another page, can you give me redirect route after login with google+ successfully.
-
Hi,
Place your redirect route in 'handleProviderCallback' method & you will be redirected accordingly.
For more reference, please see this one - https://medium.com/employbl/add-login-with-google-to-your-laravel-app-d2205f01b895
Thanks
-
Hi,
Now sign in with google+ and facebook is working fine for me, but after successfully sign in with google+ also sign in button is showing below account drop down instead of logout button. Please refer below is the screen shot for this problem. can anyone give me the solution to sort out the issue, thank you.
-
Hi,
In 'handleProviderCallback' method, when you got data from source(ex-google
) then you need to implement login functionality according to that data & you are missing this.
So, Kindly take pull from this repository - https://github.com/rahulshukla-webkul/bagisto-socialite.
We have implemented this one here.Thanks
-
Hi,
Thank you so much............! Now everything working fine regarding sign in with google+
-
@rahul after add "laravel/socialite": "^3.2.0" and run "composer update" command then showing error Class 'Laravel\Socialite\SocialiteServiceProvider' not found
-
You need to run add this service provider in your applications app.php file of config folder.
Please go through with this article - https://medium.com/justlaravel/laravel-social-login-using-socialite-45305c7ddc00
Thanks
-
@rahul Thanks
It's working for me.
one more query is How to create a Carousel in a custom theme? -
Hello Damayanti Nama,
You may refer to below link for adding carousel component
https://forums.bagisto.com/topic/1186/add-carousel-component-vuejs-into-bagisto/2 -
when I am login through google it was redirecting me back to login page
Here's my google callback url
GOOGLE_CALLBACK_URL=http://127.0.0.1:8000/customer/social-login/google/callback