我正试图在laravel中实现社交名媛
当重定向发生在谷歌并且$user = Socialite::driver('google')->stateless()->user();
指令被调用时,我收到此错误
ErrorException Object of class Laravel\Socialite\Two\User could not be converted to string
任何帮助表示感谢。
这是我的代码
public function redirectToProvider()
{
return Socialite::driver('google')->redirect();
}
/**
* Obtain the user information from GitHub.
*
* @return \Illuminate\Http\Response
*/
public function handleProviderCallback(Request $request)
{
\Log::Info("handleProviderCallback");
$query = $request->query();
\Log::Info($query);
$user = Socialite::driver('google')->stateless()->user();
\Log::Info($user);
// $user->token;
}
答案 0 :(得分:0)
\Log::Info($user);
这需要字符串而不是对象。您传递的是对象而不是字符串。
答案 1 :(得分:0)
信息(的print_r($用户,真));
用laravel辅助函数显示所有细节