Laravel Socialite谷歌登录失败,401本地环境

时间:2015-08-17 13:44:40

标签: php google-api laravel-5.1

我在Laravel 5.1上使用了socialite~2。我可以做twitter和facebook登录很好,但谷歌失败了我下面包含的日志。

我正在尝试登录之前使用我已在浏览器中接受的自签名SSL的流浪汉。这是API问题还是本地开发环境和谷歌的问题?

注意:我使用的是RAPPASOFT Laravel 5.1 Boilerplate

https://github.com/rappasoft/laravel-5-boilerplate

ClientException in Middleware.php line 69: Client error: 401

    in Middleware.php line 69
    at Middleware::GuzzleHttp\{closure}(object(Response)) in Promise.php line 199
    at Promise::callHandler('1', object(Response), array(object(Promise), object(Closure), null)) in Promise.php line 152
    at Promise::GuzzleHttp\Promise\{closure}() in TaskQueue.php line 60
    at TaskQueue->run() in CurlMultiHandler.php line 96
    at CurlMultiHandler->tick() in CurlMultiHandler.php line 123
    at CurlMultiHandler->execute(true) in Promise.php line 240
    at Promise->invokeWaitFn() in Promise.php line 217
    at Promise->waitIfPending() in Promise.php line 261
    at Promise->invokeWaitList() in Promise.php line 219
    at Promise->waitIfPending() in Promise.php line 62
    at Promise->wait() in Client.php line 130
    at Client->request('post', 'https://accounts.google.com/o/oauth2/token', array('form_params' => array('client_id' => '463541023677-a5gv76hf89htpask5kna33gptgnk3l2u.apps.googleusercontent.com', 'client_secret' => 'I2XqAx6U03igS5vFPopL_yLTM', 'code' => '4/1IoVx9wV7qbTTdgZrCsk8bvNt8qLVo0CAM1qimK_clQ', 'redirect_uri' => 'https://dpsg.dev/auth/login/google', 'grant_type' => 'authorization_code'))) in Client.php line 88
    at Client->__call('post', array('https://accounts.google.com/o/oauth2/token', array('form_params' => array('client_id' => '463541023677-a5gv76hf89htpask5kna33gptgnk3l2u.apps.googleusercontent.com', 'client_secret' => 'I2XqAx6U03igS5vFPopL_yLTM', 'code' => '4/1IoVx9wV7qbTTdgZrCsk8bvNt8qLVo0CAM1qimK_clQ', 'redirect_uri' => 'https://dpsg.dev/auth/login/google', 'grant_type' => 'authorization_code')))) in GoogleProvider.php line 55
    at Client->post('https://accounts.google.com/o/oauth2/token', array('form_params' => array('client_id' => '463541023677-a5gv76hf89htpask5kna33gptgnk3l2u.apps.googleusercontent.com', 'client_secret' => 'I2XqAx6U03igS5vFPopL_yLTM', 'code' => '4/1IoVx9wV7qbTTdgZrCsk8bvNt8qLVo0CAM1qimK_clQ', 'redirect_uri' => 'https://dpsg.dev/auth/login/google', 'grant_type' => 'authorization_code'))) in GoogleProvider.php line 55
    at GoogleProvider->getAccessToken('4/1IoVx9wV7qbTTdgZrCsk8bvNt8qLVo0CAM1qimK_clQ') in AbstractProvider.php line 187
    at AbstractProvider->user() in EloquentAuthenticationRepository.php line 137
    at EloquentAuthenticationRepository->getSocialUser('google') in EloquentAuthenticationRepository.php line 106
    at EloquentAuthenticationRepository->loginThirdParty(array('state' => '4dd7e363d9c56bbfe7e3fd046f64ea367748091d', 'code' => '4/1IoVx9wV7qbTTdgZrCsk8bvNt8qLVo0CAM1qimK_clQ'), 'google') in AuthController.php line 99
    at AuthController->loginThirdParty(object(Request), 'google')
    at call_user_func_array(array(object(AuthController), 'loginThirdParty'), array(object(Request), 'provider' => 'google')) in compiled.php line 8445
    at Controller->callAction('loginThirdParty', array(object(Request), 'provider' => 'google')) in compiled.php line 8514
    at ControllerDispatcher->call(object(AuthController), object(Route), 'loginThirdParty') in compiled.php line 8494
    at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in compiled.php line 9151
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in compiled.php line 9133
    at Pipeline->then(object(Closure)) in compiled.php line 8495
    at ControllerDispatcher->callWithinStack(object(AuthController), object(Route), object(Request), 'loginThirdParty') in compiled.php line 8480
    at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\Frontend\Auth\AuthController', 'loginThirdParty') in compiled.php line 7455
    at Route->runWithCustomDispatcher(object(Request)) in compiled.php line 7426
    at Route->run(object(Request)) in compiled.php line 7079
    at Router->Illuminate\Routing\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in compiled.php line 9151
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in RedirectIfAuthenticated.php line 41
    at RedirectIfAuthenticated->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(RedirectIfAuthenticated), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9143
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in compiled.php line 9133
    at Pipeline->then(object(Closure)) in compiled.php line 7080
    at Router->runRouteWithinStack(object(Route), object(Request)) in compiled.php line 7068
    at Router->dispatchToRoute(object(Request)) in compiled.php line 7053
    at Router->dispatch(object(Request)) in compiled.php line 2066
    at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in compiled.php line 9151
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 2687
    at VerifyCsrfToken->handle(object(Request), object(Closure)) in VerifyCsrfToken.php line 17
    at VerifyCsrfToken->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9143
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 12399
    at ShareErrorsFromSession->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9143
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 11048
    at StartSession->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9143
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 12137
    at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9143
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 12076
    at EncryptCookies->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9143
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 2737
    at CheckForMaintenanceMode->handle(object(Request), object(Closure))
    at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9143
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in compiled.php line 9133
    at Pipeline->then(object(Closure)) in compiled.php line 2013
    at Kernel->sendRequestThroughRouter(object(Request)) in compiled.php line 1999
    at Kernel->handle(object(Request)) in index.php line 54

1 个答案:

答案 0 :(得分:3)

检查您是否启用了Google+ API。

enter image description here