javascript - Add Meteor login google oauth - Stack Overflow

I'm trying to create a simple login button for button in Meteor using google oauth. I executed the

I'm trying to create a simple login button for button in Meteor using google oauth. I executed the following mands

mrt create accounts mrt add accounts-google mrt add accounts-ui

I gutted the default html/css/js and added: client/index.html server/config.js

here is config.js

Accounts.loginServiceConfiguration.remove({
   service: "google"
});
Accounts.loginServiceConfiguration.insert({
    service: "google",
    clientId: "[redacted]",
    secret: "[redacted]"
})

and here is index.html

<head>
    <title>Accounts</title>
</head>

<body>
    {{loginButtons}}
    {{#if currentUser}}
        {{currentUser.profile.login}}
    {{/if}}
</body>

However, with the config I get the following error when I try to start the server: W20140729-22:22:42.461(-5)? (STDERR) W20140729-22:22:42.844(-5)? (STDERR) /home/tim/.meteor/tools/cef2bcd356/lib/node_modules/fibers/future.js:173 W20140729-22:22:42.845(-5)? (STDERR) throw(ex); W20140729-22:22:42.845(-5)? (STDERR) ^ W20140729-22:22:42.846(-5)? (STDERR) TypeError: Cannot call method 'remove' of undefined W20140729-22:22:42.846(-5)? (STDERR) at app/server/config.js:1:71 W20140729-22:22:42.847(-5)? (STDERR) at app/server/config.js:11:3 W20140729-22:22:42.847(-5)? (STDERR) at /home/tim/Desktop/accounts/.meteor/local/build/programs/server/boot.js:161:10 W20140729-22:22:42.849(-5)? (STDERR) at Array.forEach (native) W20140729-22:22:42.850(-5)? (STDERR) at Function..each..forEach (/home/tim/.meteor/tools/cef2bcd356/lib/node_modules/underscore/underscore.js:79:11) W20140729-22:22:42.851(-5)? (STDERR) at /home/tim/Desktop/accounts/.meteor/local/build/programs/server/boot.js:82:5 => Exited with code: 8

The config is from an old tutorial so I'm wondering if the code is outdated, but I'm having trouble finding anything more recent. Does anyone have any idea what's going on?

I'm trying to create a simple login button for button in Meteor using google oauth. I executed the following mands

mrt create accounts mrt add accounts-google mrt add accounts-ui

I gutted the default html/css/js and added: client/index.html server/config.js

here is config.js

Accounts.loginServiceConfiguration.remove({
   service: "google"
});
Accounts.loginServiceConfiguration.insert({
    service: "google",
    clientId: "[redacted]",
    secret: "[redacted]"
})

and here is index.html

<head>
    <title>Accounts</title>
</head>

<body>
    {{loginButtons}}
    {{#if currentUser}}
        {{currentUser.profile.login}}
    {{/if}}
</body>

However, with the config I get the following error when I try to start the server: W20140729-22:22:42.461(-5)? (STDERR) W20140729-22:22:42.844(-5)? (STDERR) /home/tim/.meteor/tools/cef2bcd356/lib/node_modules/fibers/future.js:173 W20140729-22:22:42.845(-5)? (STDERR) throw(ex); W20140729-22:22:42.845(-5)? (STDERR) ^ W20140729-22:22:42.846(-5)? (STDERR) TypeError: Cannot call method 'remove' of undefined W20140729-22:22:42.846(-5)? (STDERR) at app/server/config.js:1:71 W20140729-22:22:42.847(-5)? (STDERR) at app/server/config.js:11:3 W20140729-22:22:42.847(-5)? (STDERR) at /home/tim/Desktop/accounts/.meteor/local/build/programs/server/boot.js:161:10 W20140729-22:22:42.849(-5)? (STDERR) at Array.forEach (native) W20140729-22:22:42.850(-5)? (STDERR) at Function..each..forEach (/home/tim/.meteor/tools/cef2bcd356/lib/node_modules/underscore/underscore.js:79:11) W20140729-22:22:42.851(-5)? (STDERR) at /home/tim/Desktop/accounts/.meteor/local/build/programs/server/boot.js:82:5 => Exited with code: 8

The config is from an old tutorial so I'm wondering if the code is outdated, but I'm having trouble finding anything more recent. Does anyone have any idea what's going on?

Share Improve this question asked Jul 30, 2014 at 3:35 Tim LindseyTim Lindsey 7571 gold badge7 silver badges20 bronze badges 2
  • your stacktrace says that Accounts.loginServiceConfiguration is undefined. That's what is going on. – imslavko Commented Jul 30, 2014 at 4:55
  • You need to use {{> loginButtons}} and the name of the google user will be stored in currentUser.profile.name, note that any other field (google id, email, picture...) has to be copied from user.services.google in the Accouns.onCreateUser callback server-side. – saimeunt Commented Jul 30, 2014 at 12:27
Add a ment  | 

1 Answer 1

Reset to default 8

All you need to do is add the service-configuration package using:

meteor add service-configuration

cheers!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745415768a4626741.html

相关推荐

  • javascript - Add Meteor login google oauth - Stack Overflow

    I'm trying to create a simple login button for button in Meteor using google oauth. I executed the

    17小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信