簡體   English   中英

添加Meteor登錄google oauth

[英]Add Meteor login google oauth

我正在嘗試使用google oauth為Meteor中的按鈕創建一個簡單的登錄按鈕。 我執行了以下命令

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

我掏空了默認的html / css / js並添加了:client / index.html server / 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/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:無法調用未定義的方法'remove'W20140729-22:22:42.846(-5)? (STDERR)在app / server / config.js:1:71 W20140729-22:22:42.847(-5)? (STDERR)在app / server / config.js:11:3 W20140729-22:22:42.847(-5)? (STDERR)/home/tim/Desktop/accounts/.meteor/local/build/programs/server/boot.js:161:10 W20140729-22:22:42.849(-5)? (STDERR)在Array.forEach(native)W20140729-22:22:42.850(-5)? (STDERR)在函數。 。每。 .forEach(/home/tim/.meteor/tools/cef2bcd356/lib/node_modules/underscore/underscore.js:79:11)W20140729-22:22:42.851(-5)? (STDERR)/home/tim/Desktop/accounts/.meteor/local/build/programs/server/boot.js:82:5 =>退出代碼:8

配置來自一個舊教程,所以我想知道代碼是否過時,但我找不到更新的東西。 有誰知道發生了什么事?

您需要做的就是使用以下命令添加service-configuration包:

meteor add service-configuration

干杯!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM