Meteor.userId() 包内为空

Meteor.userId() null inside a package

我正在创建一个流星包。此软件包在 package.json 中使用了 account-base

我在服务器端创建了一个这样的方法:

Meteor.methods({
    hide: function(notification_id){
        kahonNotification.hide(notification_id,Meteor.userId())
    }    
});

问题是 Meteor.userId() 始终为空。

这里是配置package.json文件:

Package.onUse(function(api) {
  api.versionsFrom('1.0.5');
  api.use(['standard-app-packages'], ['client','server']);
  api.use('accounts-base', 'server');

  // Allows the user of this package to choose their own Bootstrap
  // implementation.
  api.use(['twbs:bootstrap@3.3.1', 'nemo64:bootstrap@3.3.1_1'], 'client', {weak: true});

  api.addFiles(['client/notifications.html','client/notifications.js'],'client');
  api.addFiles(['server/main.js','server/publications.js'],'server');
  api.addFiles('shared/collections.js',['server','client'])

  api.imply(['templating'], 'client');
  api.export('kahonNotification')

});

Package.onTest(function(api) {
  api.use('tinytest');
  api.use('kahon:notificationsefficient');
  api.addFiles('notificationsefficient-tests.js');
});

我没有登录网页。这是解决方案。