添加Meteor登录google oauth

Add Meteor login google oauth

本文关键字:oauth google 登录 Meteor 添加      更新时间:2023-09-26

我试图创建一个简单的登录按钮在流星使用谷歌oauth按钮。我执行了以下命令

mrt创建帐户MRT添加账户-谷歌MRT add accounts-ui

我去掉了默认的html/css/js,并添加了:客户端/index . html服务器/config.js

这里是config.js

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

这里是index.html

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

然而,配置我得到以下错误,当我试图启动服务器:W20140729-22:22:42.461 (5) ?(STDERR)W20140729-22:22:42.844 (5) ?(STDERR)/home/tim/.meteor/tools/cef2bcd356/lib/node_modules/纤维/future.js: 173W20140729-22:22:42.845 (5) ?(STDERR ) 把(ex);W20140729-22:22:42.845 (5) ?(STDERR ) ^W20140729-22:22:42.846 (5) ?类型错误:无法调用未定义的方法'remove'W20140729-22:22:42.846 (5) ?在app/server/config.js:1:71W20140729-22:22:42.847 (5) ?(STDERR)在app/server/config.js:11:3W20140729-22:22:42.847 (5) ?在/home/time/desktop/accounts/.meteor/local/build/programs/server/boot.js:161:10W20140729-22:22:42.849 (5) ?(STDERR)在数组。forEach(本地)W20140729-22:22:42.850 (5) ?(STDERR)函数。.each.。forEach (/home/tim/.meteor/工具/cef2bcd356/lib/node_modules/强调/underscore.js: 79:11)W20140729-22:22:42.851 (5) ?在/home/time/desktop/accounts/.meteor/local/build/programs/server/boot.js:82:5=>退出代码:8

配置是从一个旧的教程,所以我想知道如果代码是过时的,但我有困难找到任何更近期。有人知道发生了什么吗?

你所需要做的就是添加服务配置包:

meteor add service-configuration

干杯!