Laravel 社交名流 - google 登录失败“缺少必需的参数:代码”

Laravel Socialite - google login failed “Missing required parameter: code”

我在使用 Laravel 社交名流通过 Google API.

登录用户时遇到了这个奇怪的问题

所有的配置看起来都很正常,但是我却不断收到

error Missing required parameter: code

但在 localhost 中工作正常

本地主机:

服务器:

自动重定向的 URI http://example.com/subdir/auth/google/callback http://localhost:8000/auth/google/callback

经过长时间的搜索,解决方案是从 scopes 中删除 vendor\laravel\socialite\src\Two\GoogleProvider.php

中的 profile
protected $scopes = [
    'openid',
    'email',
];