@rober You're welcome.
1- As a backend you don't need to create any google app, frontend should do.
2- Yes it works, But you need to edit your config/services.php file to be like this :
And the validateProvider function in SocialiteController to be like this :
protectedfunctionvalidateProvider($provider){if(!in_array($provider,['google','facebook'])){returnresponse()->json(["message"=>'You can only login via google or Facebook accounts'],400);}}
You can get the access_provider_token for testing purpose through this flutter app or through this website.
And remember that as an API the frontend application must send the access_provider_token through the request.
is there no providers table to know which this user comes from google ,GitHub or Facebook ??
and how mobile developer sends me access_token_provider in callback ??
@ahmedali190000
1- Yes, of course, if you want to store from which provider each user came from, you must have a providers_table.
2- Mobile developers can send you the access_token_provider in the request parameters or body, but if you mean the token itself it's better to send it using the request body as it may be too long to be in the request parameters.
We're a place where coders share, stay up-to-date and grow their careers.
Great article, I really need this.
Also, thanks for sharing the Flutter app.
@philipdroubi , Do I need to create a Google app to get client_id and client_secret ?
And does this work with Facebook, Github and other providers??
@rober You're welcome.
1- As a backend you don't need to create any google app, frontend should do.
2- Yes it works, But you need to edit your
config/services.phpfile to be like this :And the
validateProviderfunction inSocialiteControllerto be like this :Bro!, Thank you!
@keyvervelasquez You're welcome.
where can i find the access_provider_token ?
The redirect is not obligatory?
@229okpe
You can get the access_provider_token for testing purpose through this flutter app or through this website.
And remember that as an API the frontend application must send the access_provider_token through the request.
No need for any redirect.
You saved my day.
Cheers mate!
My pleasure! 😃
is there no providers table to know which this user comes from google ,GitHub or Facebook ??
and how mobile developer sends me access_token_provider in callback ??
@ahmedali190000
1- Yes, of course, if you want to store from which provider each user came from, you must have a
providers_table.2- Mobile developers can send you the
access_token_providerin the request parameters or body, but if you mean the token itself it's better to send it using the request body as it may be too long to be in the request parameters.