Meteor accounts with external services

I am building a website in which a user has to register first and then he can merge his steam account with it. I am confronting a problem, because with external services you cannot merge account, you can only login and therefore Meteor creates a new user in the database. I “solved” this in a strange way. I am using steam login with scholtzm:accounts-steam package.

I changed a function Accounts.onCreateUser in server side like this:

Accounts.onCreateUser(function(options, user) {

    if (Meteor.user() != null) {
        Meteor.users.update({_id: Meteor.user()._id}, { $set: { '': } });
        return Meteor.user();

    return user;

So the user first registers with the email and password, then he can connect the steam account with his account. Function above is called on the server when he logs in with Steam and I get the data I need to merge with the previous account, then I don’t even create a new account (check return of the user). I return the previous account (Meteor.user()), which logs some errors, but works in the exact way I want it to work.

To conclude, I want to merge my steam account with the Meteor account. How can I do this in a more secure and better way? Is there also a possibility to rewrite packages with external services and handle this properly? Any help is appreciated!