Laravel Socialite-Google登录失败“缺少所需参数:代码" [英] Laravel Socialite - google login failed “Missing required parameter: code”
问题描述
使用Laravel Socialite通过Google API登录用户时,我遇到了一个奇怪的问题.
I have this strange issue with using Laravel Socialite to log users in via Google API.
所有配置似乎都是正常的,但我一直在获得
Everything configurations seem normal and ordinary, but I keep getting
错误缺少必填参数:代码
error Missing required parameter: code
但是在localhost中可以正常工作
But in localhost works fine
本地主机:
服务器:
自动重定向URI http://example.com/subdir/auth/google/callback http://localhost:8000/auth/google/callback
URI de redirection autorisés http://example.com/subdir/auth/google/callback http://localhost:8000/auth/google/callback
推荐答案
经过长时间搜索,解决方案是从vendor\laravel\socialite\src\Two\GoogleProvider.php
After a long search, the solution is to remove the profile
from scopes
in vendor\laravel\socialite\src\Two\GoogleProvider.php
protected $scopes = [
'openid',
'email',
];
这篇关于Laravel Socialite-Google登录失败“缺少所需参数:代码"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!