laravel 版本报错 Undefined constant "Overtrue\Socialite\Contracts\ABNF_ID"
aoeng opened this issue · 12 comments
Laravel : 9.30.1
Laravel-sociclite: 4.0.1
php : 8.1
[2022-09-21 10:35:54] local.ERROR: Undefined constant "Overtrue\Socialite\Contracts\ABNF_ID" {"userId":5,"exception":"[object] (Error(code: 0): Undefined constant \"Overtrue\\Socialite\\Contracts\\ABNF_ID\" at /www/wwwroot/faceabyss/vendor/overtrue/socialite/src/Providers/WeChat.php:190)
[stacktrace]
#0 /www/wwwroot/faceabyss/vendor/overtrue/socialite/src/Providers/WeChat.php(31): Overtrue\\Socialite\\Providers\\WeChat->prepareForComponent()
#1 /www/wwwroot/faceabyss/vendor/overtrue/socialite/src/SocialiteManager.php(76): Overtrue\\Socialite\\Providers\\WeChat->__construct()
#2 /www/wwwroot/faceabyss/vendor/overtrue/socialite/src/SocialiteManager.php(99): Overtrue\\Socialite\\SocialiteManager->buildProvider()
#3 /www/wwwroot/faceabyss/vendor/overtrue/socialite/src/SocialiteManager.php(56): Overtrue\\Socialite\\SocialiteManager->createProvider()
#4 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(338): Overtrue\\Socialite\\SocialiteManager->create()
#5 /www/wwwroot/faceabyss/app/Http/Controllers/AuthController.php(122): Illuminate\\Support\\Facades\\Facade::__callStatic()
#6 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\\Http\\Controllers\\AuthController->oauth()
#7 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction()
#8 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Routing/Route.php(261): Illuminate\\Routing\\ControllerDispatcher->dispatch()
#9 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Routing/Route.php(204): Illuminate\\Routing\\Route->runController()
#10 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Routing/Router.php(725): Illuminate\\Routing\\Route->run()
#11 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}()
#12 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#13 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle()
#14 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(126): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#15 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(102): Illuminate\\Routing\\Middleware\\ThrottleRequests->handleRequest()
#16 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(54): Illuminate\\Routing\\Middleware\\ThrottleRequests->handleRequestUsingNamedLimiter()
#17 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Routing\\Middleware\\ThrottleRequests->handle()
#18 /www/wwwroot/faceabyss/vendor/laravel/sanctum/src/Http/Middleware/EnsureFrontendRequestsAreStateful.php(33): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#19 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Laravel\\Sanctum\\Http\\Middleware\\EnsureFrontendRequestsAreStateful->Laravel\\Sanctum\\Http\\Middleware\\{closure}()
#20 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#21 /www/wwwroot/faceabyss/vendor/laravel/sanctum/src/Http/Middleware/EnsureFrontendRequestsAreStateful.php(34): Illuminate\\Pipeline\\Pipeline->then()
#22 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Laravel\\Sanctum\\Http\\Middleware\\EnsureFrontendRequestsAreStateful->handle()
#23 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#24 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Routing/Router.php(726): Illuminate\\Pipeline\\Pipeline->then()
#25 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Routing/Router.php(703): Illuminate\\Routing\\Router->runRouteWithinStack()
#26 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Routing/Router.php(667): Illuminate\\Routing\\Router->runRoute()
#27 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Routing/Router.php(656): Illuminate\\Routing\\Router->dispatchToRoute()
#28 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(167): Illuminate\\Routing\\Router->dispatch()
#29 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#30 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#31 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#32 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#33 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#34 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#35 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#36 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#37 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#38 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#39 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#40 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(62): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#41 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle()
#42 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#43 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#44 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#45 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(142): Illuminate\\Pipeline\\Pipeline->then()
#46 /www/wwwroot/faceabyss/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(111): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#47 /www/wwwroot/faceabyss/public/index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle()
#48 {main}
"}
$userInfo = Socialite::create($request->input('platform'))->userFromCode($request->input('code'));
更新到新版试试:
composer require overtrue/socialite:^4.5.1
好了,顺便问下,因为做个APP和网站,所以加了微信的别名,这里怎么获取provider的名称啊
$userInfo = Socialite::create($request->input('platform'))->userFromCode($request->input('code'));
$userInfo->getProvider(); //这里获取的是类名,我看到里面有个NAME,但不知道怎么获取
'wechat' => [
'provider' => 'wechat',
...
],
'wechat-pc' => [
'provider' => 'wechat',
...
]
$userInfo->getProvider()::NAME;
会不会很难看0.0
欢迎 PR。
Undefined constant "Overtrue\Socialite\Contracts\ABNF_APP_ID"
一样的错误
@overtrue facebook mapUserToObject 方法, 第一行的 Contracts\ABNF_ID 自动加载会有问题,google不会有问题,因为 User implements Contracts\UserInterface 会正常加载
版本号多少? yushine @.>于2022年10月17日 周一09:34写道:
…
@overtrue https://github.com/overtrue facebook mapUserToObject 方法, 第一行的 Contracts\ABNF_ID 自动加载会有问题,google不会有问题,因为 User implements Contracts\UserInterface 会正常加载 Facebook: [image: image] https://user-images.githubusercontent.com/728951/196070792-7bfd1b44-91d2-4f1b-8ba8-8b1cf41b76f3.png Google: [image: image] https://user-images.githubusercontent.com/728951/196071025-d909bf5d-7910-4b8a-b6ca-d87fa21b558f.png — Reply to this email directly, view it on GitHub <#248 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALHOYBBA6H6Z4MPSMJOZFDWDSUJ7ANCNFSM6AAAAAAQRUJNXQ . You are receiving this because you were mentioned.Message ID: @.>
4.5.1 和 4.6.x 都一样报错