我沒有刪除autopublish也沒有不安全的包,但是當我運行Meteor.user()時,它顯示服務。 Facebook對象,但不是services.google對象(也不是services.password,但我不需要那個)。流星未發佈包含自動發佈包的所有用戶字段
Google和Facebook對象肯定都在數據庫中,爲什麼它只顯示一個?你將如何去解決問題? autupub開啓時,我認爲所有的領域都是惡劣的。
我沒有刪除autopublish也沒有不安全的包,但是當我運行Meteor.user()時,它顯示服務。 Facebook對象,但不是services.google對象(也不是services.password,但我不需要那個)。流星未發佈包含自動發佈包的所有用戶字段
Google和Facebook對象肯定都在數據庫中,爲什麼它只顯示一個?你將如何去解決問題? autupub開啓時,我認爲所有的領域都是惡劣的。
首先,確保「.meteor/packages」文件中列出了「accounts-base」,「accounts-facebook」和「accounts-google」。一切都表明你沒有將「accounts-google」包添加到該文件中。
發佈「Meteor.users」的「accounts-base」包將覆蓋默認的自動發佈功能(https://github.com/meteor/meteor/blob/devel/packages/accounts-base/accounts_common.js#L82)。
想要知道哪些欄獲得汽車公佈參考源代碼在accounts_server.js,開始於:https://github.com/meteor/meteor/blob/devel/packages/accounts-base/accounts_server.js#L683
你會看到下面的(閱讀評論):
// If autopublish is on, publish these user fields. Login service
// packages (eg accounts-google) add to these by calling
// Accounts.addAutopublishFields Notably, this isn't implemented with
// multiple publishes since DDP only merges only across top-level
// fields, not subfields (such as 'services.facebook.accessToken')
var autopublishFields = {
loggedInUser: ['profile', 'username', 'emails'],
otherUsers: ['profile', 'username']
};
這意味着「accounts.addAutopublishFields」方法將由「accounts-google」,「accounts-facebook」等軟件包調用,以向該出版物添加字段。
現在,例如,如果你看一下"accounts-google" package,在「google.js」的文件,它具有以下內容:如果你有「賬戶,谷歌」打包啓用
Accounts.addAutopublishFields({
forLoggedInUser: _.map(
// publish access token since it can be used from the client (if
// transmitted over ssl or on
// localhost). https://developers.google.com/accounts/docs/OAuth2UserAgent
// refresh token probably shouldn't be sent down.
Google.whitelistedFields.concat(['accessToken', 'expiresAt']), // don't publish refresh token
function (subfield) { return 'services.google.' + subfield; }),
forOtherUsers: _.map(
// even with autopublish, no legitimate web app should be
// publishing all users' emails
_.without(Google.whitelistedFields, 'email', 'verified_email'),
function (subfield) { return 'services.google.' + subfield; })
});
這意味着,它發佈以下字段爲「Meteor.users」:
當登錄:「輪廓」,「用戶名」,「電子郵件」以及除「的accessToken」所有「service.google」領域,「expiresAt」
註銷時:'profile','用戶名'和除'email','verified_email'之外的所有「service.google」字段
「accounts-facebook」包裝的內容相同。
嗯,沒有看到我的項目在哪裏。似乎被覆蓋,如果我在生成文件夾中更改它。源文件在哪裏?我只是困惑,爲什麼Facebook正在出版...該包必須發佈它,我猜? – timmyg13
我已經添加了一些細節到我的原始答案。這個軟件包是一個基礎軟件包,因此它不在您的項目中,Meteor將它添加到「.meteor/packages」文件時會自動捆綁它(就像autopublish一樣)。您可以在這裏克隆Meteor源代碼:https://github.com/meteor/meteor – FredericoC