Merging multiple user accounts with Meteor

2019-08-07 01:32发布

There is a good article on merging multiple user accounts with Meteor: http://www.meteorpedia.com/read/Merging_OAuth_accounts

I have an already logged in user. I want to the currently logged in user to login to Facebook and Linkedin and merge all the service objects. For this, I have created an Account.onCreateUser() function

Within the onCreateUser() function, I require to retrieve the following information:

  1. current UserId: I tried this.userId, it is not working
  2. current SessionId: in client, Meteor.data_connection._lastSessionId. Not sure how to get this in the server.

Any help is very useful.

2条回答
贪生不怕死
2楼-- · 2019-08-07 01:57

I'm using package meteor-accounts-meld

查看更多
我只想做你的唯一
3楼-- · 2019-08-07 02:06

The best way to merge multiple accounts is writing custom code in Accounts.onCreateUser. Within this method, retrieving session Id does not work. Migration of user data based on session Id should happen after accounts are migrated. Also, for this.userId to work within Accounts.onCreateUser, do not create new users in Meteor.startup.

查看更多
登录 后发表回答