1

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.

vijayst
  • 20,359
  • 18
  • 69
  • 113
  • Can you add your existing code? – Stephen Woods Feb 01 '16 at 14:52
  • this.userId is working usually, but does not work when I try to create a user in Meteor.startup. this.connection always is a null value within onCreateUser. – vijayst Feb 02 '16 at 12:31
  • I rearranged the existing code to avoid sessions completely as it does not seem to have server side support. I worked around the problems that I have listed above. – vijayst Feb 02 '16 at 12:31
  • @Vijay if any answer has solved your question please consider accepting one answer by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this. – asingh Feb 10 '16 at 16:50

2 Answers2

0

I'm using package meteor-accounts-meld

none
  • 1,699
  • 2
  • 13
  • 18
0

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.

vijayst
  • 20,359
  • 18
  • 69
  • 113