在使用 EveryAuth NPM lib 向 google 进行 OAuth2.0 调用时,我正在尝试检索 google 电子邮件地址。有没有人设法让电子邮件使用 EveryAuth 返回?
everyauth.google
.entryPath('/auth/google')
.callbackPath('/auth/google/callback')
.appId('216450162097.apps.googleusercontent.com')
.appSecret('8b6yf2nznWHgAu7iKNyGn-0F')
.scope(['https://www.googleapis.com/auth/userinfo.email'])
.findOrCreateUser( function(session, userAttributes) {
console.log(userAttributes); })
.redirectPath('/');
范围:https ://www.googleapis.com/auth/userinfo.email导致异常:
错误:错误 401(未找到)!!1 display:block;height:55px;margin:0 0 -7px;width:150px}* > #g{margin-left:-2px}#g img{visibility:hidden} * html #g img{visibility:visible}*+html #g img{visibility:visible}
401. 这是一个错误。
您的请求中有错误。我们知道的就这些。
在 EventEmitter 的 [object Object].fail (/Users/thegoleffect/Documents/Projects/Spoondate/nitrous/node_modules/everyauth/lib/promise.js:50:15)。(/Users/thegoleffect/Documents/Projects/Spoondate/nitrous/node_modules/everyauth/lib/modules/google.js:58:15) 在 EventEmitter.emit (events.js:67:17) 在 EventEmitter._respond (/Users /thegoleffect/Documents/Projects/Spoondate/nitrous/node_modules/everyauth/node_modules/restler/lib/restler.js:127:12) 在 EventEmitter._fireEvents (/Users/thegoleffect/Documents/Projects/Spoondate/nitrous/node_modules/everyauth /node_modules/restler/lib/restler.js:131:52)在 /Users/thegoleffect/Documents/Projects/Spoondate/nitrous/node_modules/everyauth/node_modules/restler/lib/restler.js:115:19 在 IncomingMessage。(/Users/thegoleffect/Documents/Projects/Spoondate/nitrous/node_modules/everyauth/node_modules/restler/lib/restler.js:205:5) 在 IncomingMessage。(/Users/thegoleffect/Documents/Projects/Spoondate/nitrous/node_modules/everyauth/node_modules/restler/lib/restler.js:113:32) 在 IncomingMessage.emit (events.js:81:20) 在 HTTPParser.onMessageComplete ( http.js:133:23)