[英]Missing scope error on Google authentication callback using Node.js/Passport
此错误仅在Heroku(生产)上发生,而不是在本地发生。 我试过了两个:
passport.authenticate('google', { scope: 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/analytics.readonly' })
和,
passport.authenticate('google', { scope: ['profile', 'email'] })
范围是数组还是空格分隔的字符串。
当我转到Google身份验证链接时,范围IS在URL中。 在我的实时制作应用中生成的没有区别。
但我仍然得到:
Error 400
Error: invalid_request
Missing required parameter: scope
我认为您使用的是Passport Google OAuth,而不仅仅是Passport Google(OpenId)模块?
如果您使用的是OAuth通行证,则使用Google进行身份验证需要额外的范围参数。
作为字符串传递,您必须将'openid'作为第一个单词传递,例如:例如,如果您希望按文件访问用户的Google云端硬盘,
openid profile email https://www.googleapis.com/auth/drive.file
来源(S):
https://developers.google.com/identity/protocols/OpenIDConnect#scope-param https://developers.google.com/+/api/oauth#login-scopes
对于错误消息
Error 400
Error: invalid_request
Missing required parameter: scope
您需要在表单中添加范围
<input type="hidden" name="scope" value="https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo#email https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/tasks https://www-opensocial.googleusercontent.com/api/people https://www.googleapis.com/auth/plus.login" />
请通过linkedin,facebook,twitter和谷歌提供商示例应用程序参考春季社交登录 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.