我正在尝试使用Laravel社交名媛并使用Goodreads登录。我收到错误消息Driver [goodreads]不支持。我遵循了本文档https://socialiteproviders.netlify.com/providers/goodreads.html 我查找的所有stackoverflow问题都与在app.php中不添加Laravel \ Socialite \ SocialiteServiceProvider有关,但是我的文档说要删除它。
在我的 app.php 中,添加了\ SocialiteProviders \ Manager \ ServiceProvider :: class, 我还添加了'Socialite'=> Laravel \ Socialite \ Facades \ Socialite :: class,
我的 eventserviceprovider.php 如下
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
\SocialiteProviders\Manager\SocialiteWasCalled::class => [
// add your listeners (aka providers) here
'SocialiteProviders\\Goodreads\\GoodreadsExtendSocialite@handle',
],
];
我的登录控制器
/**
* Redirect the user to the Goodreads authentication page.
*
* @return \Illuminate\Http\Response
*/
public function redirectToProvider()
{
return Socialite::with('Goodreads')->redirect();
}
/**
* Obtain the user information from Goodreads.
*
* @return \Illuminate\Http\Response
*/
public function handleProviderCallback()
{
$user = Socialite::with('Goodreads')->user();
$accessTokenResponseBody = $user->accessTokenResponseBody;
dd($user);
}
我的路线web.php
Route::get('login/Goodreads', 'Auth\LoginController@redirectToProvider');
Route::get('login/Goodreads/callback','Auth\LoginController@handleProviderCallback');
请让我知道我在想什么。让我知道您是否还有其他需要。
谢谢