1
I am developing an API using Laravel 5.8 to be consumed in a flutter application. So, I’m using Laravel Socialite to log in with Facebook and Google. However, I’m still new to these frameworks and I don’t know how to log in to the application through the api with the socialite.
I used this code snippet for the site and it worked.
class SocialAuthController extends Controller
{
public function redirect($social)
{
return Socialite::driver($social)->redirect();
}
public function callback($social)
{
$user = SocialAccountService::createOrGetUser(Socialite::driver($social)->stateless()->user(), $social);
auth()->login($user);
return redirect()->to('/');
}
}
Can someone refer me some material or a solution to create an API using Socialite so that in the Flutter application I can consume this api and somehow receive the user data as a return of this api?
This is Matthew speaking. This might help: https://stackoverflow.com/questions/35966605/using-laravel-socialite-with-an-api
– Filipe Damasceno