I have this function for socialite login:
public function login()
{
return Socialite::driver('facebook')->redirect();
}
public function callback()
{
return redirect('/')->with('message','Logged in!!');
}
The callback function only redirects to homepage where there is a form to add, a song:
public function add(Request $request)
{
$newSong = new Song();
$newSong->name=$request->song;
$newSong->added_by=Socialite::driver('facebook')->user()->name;
$nrwSong->save();
}
But when i try to add added_by field in database from this social authentication, it gives
InvalidStateException in AbstractProvider.php
What am i doing wrong here? I can see user details if i dd(Socialite::driver('facebook')->user()); in callback function.