Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript meteor中的服务配置应该放在哪里?在客户端还是在服务器端?_Javascript_Meteor_Linkedin_Meteor Accounts - Fatal编程技术网

Javascript meteor中的服务配置应该放在哪里?在客户端还是在服务器端?

Javascript meteor中的服务配置应该放在哪里?在客户端还是在服务器端?,javascript,meteor,linkedin,meteor-accounts,Javascript,Meteor,Linkedin,Meteor Accounts,我正在使用linkedin按钮进行自定义登录。我有accounts base,accounts oauth和pauli:accounts linkedin软件包。我使用了linkedin开发者网站上的客户id和秘密,如下所示 Meteor.startup(function() { ServiceConfiguration.configurations.update({ 'service': 'linkedin', }, { $set: {

我正在使用linkedin按钮进行自定义登录。我有
accounts base
accounts oauth
pauli:accounts linkedin
软件包。我使用了linkedin开发者网站上的客户id和秘密,如下所示

Meteor.startup(function() {
    ServiceConfiguration.configurations.update({
        'service': 'linkedin',
    },
    {
        $set: {
            'clientId': 'myClientId',
            'secret': 'mySecret'
        }
    },
    {
        upsert: true
    });
});
在iron路由器中,我还在/login模板上定义了waitOn函数,如下所示:

this.route('login', {
    path: '/login',
    waitOn: function() {
       Accounts.loginServicesConfigured();
    }
});
现在,当我点击按钮时,会打开一个弹出窗口,但它不会加载linkedin登录页面,并显示“错误内容解码失败”。


我已经在客户端的Meteor.startup函数中编写了ServiceConfiguration。我在客户端编写serviceconfiguration正确吗?还是应该在服务器端编写

它应该在服务器端。根据这里的流星记录

上面说

登录服务配置通过网络从服务器发送到客户端 应用程序启动时的DDP


我已经在服务器端成功地为google帐户进行了服务配置。

似乎有一个通用的解决方案

首先,添加服务配置包:

meteor添加服务配置

然后,在你的应用程序中:


我通常只是在服务器中放一个service-config.js文件,其中包含此代码。

好的。我已经在服务器端对其进行了配置,但url中的“客户端id”仍然没有定义。对我来说,我没有将其包装在
Meteor.startup
下。试着把它放到Meteor.startup中,看看它是否有效。我已经在根目录中定义了settings.json。我已经从Meteor.startup函数中删除了我编写的所有内容,并将其放在一个单独的文件中,名为configure-services.js,其中包含以下代码:const services=Meteor.settings.private.oAuth;const configure=function();
ServiceConfiguration.configurations.upsert(
      { service: 'weibo' },
      {
        $set: {
          clientId: '1292962797',
          loginStyle: 'popup',
          secret: '75a730b58f5691de5522789070c319bc'
        }
      }
    );