我用passport-google-oauth运行node.js。在我的package.json上:
"passport-google-oauth": "~1.0.0",我遵循了这个教程:https://scotch.io/tutorials/easy-node-authentication-google
在google APIs中,我设置了一个项目,并且在我的express.js javascript中使用了client-id,client-secret。我还在google APIs和我的javascript中使用了相同的重定向url。还可以在授权的JavaScript源中设置我的web应用程序url
当我尝试使用我的google账号登录时,我被带到一个google页面,然后我按下“允许”,该页面被重定向到我的重定向url。然后,我得到这个(stacktrace中省略的路径):
未经授权的500
TokenError:未经授权
at Strategy.OAuth2Strategy.parseErrorResponse
at Strategy.OAuth2Strategy._createOAuthError
at node_modules/passport-google-oauth/node_modules/passport-google-oauth20/node_modules/passport-oauth2/lib/strategy.js:166:45
at node_modules/passport-google-oauth/node_modules/passport-google-oauth20/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:177:18
at passBackControl
at IncomingMessage.<anonymous>
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:448:13)有没有人经历过这种情况,或者知道问题可能是什么?
发布于 2016-08-25 08:34:32
这最终是一个愚蠢的复制-粘贴:当我从谷歌复制密钥时,我复制了一个空格。如果这种情况发生在某人身上,只需删除末尾的空格即可。
https://stackoverflow.com/questions/38809776
复制相似问题