简体   繁体   English

Laravel Socialite-Google登录失败“缺少所需参数:代码”

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

I have this strange issue with using Laravel Socialite to log users in via Google API. 使用Laravel Socialite通过Google API登录用户时,我遇到了一个奇怪的问题。

Everything configurations seem normal and ordinary, but I keep getting 一切配置看起来都很正常,但我一直

error Missing required parameter: code 错误缺少必需的参数:代码

But in localhost works fine 但是在本地主机上工作正常

Localhost: 本地主机: 在此处输入图片说明

Server: 服务器: 在此处输入图片说明

URI de redirection autorisés http://example.com/subdir/auth/google/callback http://localhost:8000/auth/google/callback 自动重定向URI http://example.com/subdir/auth/google/callback http:// localhost:8000 / auth / google / callback

After a long search, the solution is to remove the profile from scopes in vendor\\laravel\\socialite\\src\\Two\\GoogleProvider.php 经过长时间的搜索,解决方案是从vendor\\laravel\\socialite\\src\\Two\\GoogleProvider.php scopes中删除profile

protected $scopes = [
    'openid',
    'email',
];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM