Meteor JS帐户 - 谷歌包不适合我

Ful*_*ack 4 google-api oauth-2.0 meteor

我是流星新手,刚使用帐户谷歌遇到问题(见下文).我所做的只是按照http://docs.meteor.com/#meteor_loginwithexternalservice上的说明进行操作.有关如何解决此问题并使Google登录正常工作的任何想法?谢谢!

终端输出:

W20141003-09:42:57.115(7)? (STDERR) 
W20141003-09:42:57.116(7)? (STDERR) /Users/aw/.meteor/packages/meteor-tool/.1.0.33.alt9dq++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141003-09:42:57.116(7)? (STDERR)                         throw(ex);
W20141003-09:42:57.117(7)? (STDERR)                               ^
W20141003-09:42:57.118(7)? (STDERR) ReferenceError: ServiceConfiguration is not defined
W20141003-09:42:57.119(7)? (STDERR)     at app/server/accounts.js:26:1
W20141003-09:42:57.120(7)? (STDERR)     at app/server/accounts.js:35:3
W20141003-09:42:57.120(7)? (STDERR)     at /Users/aw/TS/.meteor/local/build/programs/server/boot.js:168:10
W20141003-09:42:57.120(7)? (STDERR)     at Array.forEach (native)
W20141003-09:42:57.121(7)? (STDERR)     at Function._.each._.forEach (/Users/aw/.meteor/packages/meteor-tool/.1.0.33.alt9dq++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141003-09:42:57.121(7)? (STDERR)     at /Users/aw/TS/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
Run Code Online (Sandbox Code Playgroud)

当我注释掉我的服务配置代码时(如下)

// first, remove configuration entry in case service is already configured
ServiceConfiguration.configurations.remove({
  service: "google"
});
ServiceConfiguration.configurations.insert({
  service: "google",
  clientId: "xxxxxxxx",
  secret: "xxxxxxxxx"
});
Run Code Online (Sandbox Code Playgroud)

它要求我从bootstrap下拉列表中输入clientId和secret.那之后没有任何事情发生.

添加service-configuration后,登录后收到以下错误: 在此输入图像描述

Ful*_*ack 11

事实证明,除此之外meteor add service-configuration,您还必须在Google的API网站中完成以下所有内容:

  1. https://console.developers.google.com/project
  2. "创建项目"
  3. 等待项目配置
  4. 侧栏上的"API&auth","凭据"
  5. "创建新的客户端ID"
  6. 粘贴"授权的JavaScript源"和"授权的重定向URI"
  7. "创建客户端ID"
  8. 将客户端密钥和客户端ID复制到您的应用配置
  9. 侧栏"同意屏幕"上的"API&auth"
  10. 输入"产品名称"字段并保存

在过去的几天里,第9步和第10步似乎是Google的新要求.有关问题,请参阅此Github门票.


sai*_*unt 10

你需要meteor add service-configuration手动.

其余的代码对我来说很好.

您还需要确保在Google Developers Console中正确配置了内容.

添加http://localhost:3000/_oauth/google?closeREDIRECT URIS部分以及http://localhost:3000/JAVASCRIPT ORIGINS部分.

这是出于localhost的测试目的,您需要http://www.example.com/在推送到生产时添加已部署的应用实际ROOT_URL().

我在这里解决了类似的问题:

在(显然)成功登录后,Meteor.user为空