将服务连接到现有的流星帐户 [英] Connect service to existing meteor account

查看:92
本文介绍了将服务连接到现有的流星帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置一个流星应用程序,该应用程序涉及使用用户名和密码进行注册,然后希望将该帐户与facebook和twitter关联。

I am setting up a meteor app that involves signing up with a username and password, then hopefully connecting that account with facebook and twitter.

我有第一部分只需使用帐户软件包,即可轻松启动和运行。但是,当我有一个登录用户调用Meteor.loginWithFacebook()时,它将注销它们并创建一个新帐户。我想要的是将facebook凭据添加到当前登录用户的东西。

I have the first part up and running easily, just with the accounts package. But when I have a logged in user call Meteor.loginWithFacebook(), it logs them out and creates a new account. What I want is something that adds the facebook credentials to the currently logged in user.

流星文档具有以下内容:

The meteor docs have this:

{
  _id: "bbca5d6a-2156-41c4-89da-0329e8c99a4f",  // Meteor.userId()
  username: "cool_kid_13", // unique name
  emails: [
    // each email address can only belong to one user.
    { address: "cool@example.com", verified: true },
    { address: "another@different.com", verified: false }
  ],
  createdAt: Wed Aug 21 2013 15:16:52 GMT-0700 (PDT),
  profile: {
    // The profile is writable by the user by default.
    name: "Joe Schmoe"
  },
  services: {
    facebook: {
      id: "709050", // facebook id
      accessToken: "AAACCgdX7G2...AbV9AZDZD"
    },
    resume: {
      loginTokens: [
        { token: "97e8c205-c7e4-47c9-9bea-8e2ccc0694cd",
          when: 1349761684048 }
      ]
    }
  }
}

似乎是一个具有用户名的帐户,该用户名也已通过Facebook进行了身份验证。但是我不确定这是否仅仅是您不能用基本的流星东西真正实现的例子。

which appears to be an account with a username that's also authenticated with Facebook. But I'm not sure if that's just an example that you can't actually achieve with basic Meteor stuff.

我想做的基本上是

Meteor.connectWithExternalAccount();

其运行过程与Meteor.loginWithExternalAccount()相同,但只是将信息添加到当前记录的

which runs the same process as Meteor.loginWithExternalAccount(), but just adds the information to the currently logged in user.

如果有人可以稍微解释一下基于帐户的软件包,那么我就知道从哪里着手,那就太好了。

If someone could just explain the accounts-base package a bit so I could know where to start for myself that would be great.

还,有人知道它是否将包含在未来的Meteor版本中吗?

Also, does anyone know if this will be included in any future versions of Meteor?

推荐答案

因此,已经有工作来解决此问题,但不幸的是,请求请求 https://github.com/流星/流星/拉/ 1133 从未合并。最好的选择是检查以流星为核心的Google网上论坛,看看是否有任何评论,如果没有,请看看您是否可以让核心开发者对此发表评论。

So there's been work to solve this problem, but unfortunately the pull request https://github.com/meteor/meteor/pull/1133 never got merged. Probably your best bet is check the meteor-core Google Groups and see if there was any comment on it and if not, see if you can get a core dev to comment on it.

如果您仍要使用拉取请求,则可以删除各种流星 accounts-* 包,然后在项目的根目录中,创建一个 / packages 文件夹,然后将yubozhao修补过的 accounts-* 包复制到在那里(附加 -custom 可能很聪明)。然后,您将流星添加基于帐户的自定义帐户,等等,以将其添加到您的项目中。

If you want to still use the pull request, what you could do is remove the various Meteor accounts-* packages, then in the root of your project, create a /packages folder and copy yubozhao's patched accounts-* packages in there (probably smart to append -custom). You'd then meteor add accounts-base-custom, etc. to add them to your project.

注意但是,yubozhao在6到7个月前写道,您可能需要坚持使用当时最新的任何版本的Meteor,才能使其正常工作。

Note though, yubozhao wrote this is 6-7 months ago and you may need to stick with whatever version of Meteor that was current then for it to work.

2014年4月更新:
现在有一个Atmosphere软件包,其中有一个类似的用例可能会有用: https://atmospherejs.com/package/accounts-merge

这篇关于将服务连接到现有的流星帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆