Append oAuth credentials to current user

Let’s say I add two oauth login flows:

  1. GitHub
  2. Slack

If a user logs in with GitHub and on their dashboard I have a link that triggers Meteor.loginWithSlack({redirectUrl: 'http://localhost:3000'});

Right now this creates a new user. What would be the easiest way to append this to the current users credentials?

Basically I just want to leverage the oAuth flow to get token credentials and other information the oAuth provider provides without logging user in… or even creating account. The docs briefly mention this “Standalone OAuth client use” but no examples.


I was able to “hack” it with

The hack part is that I had to rewrite the Slack oauth locally because bozhao’s package couldn’t pull in the right namespace from another package.

edit: Also seems that the way he does it is the most meteor appropriate way. Other packages do weird hacky things like create a new account then delete/merge it. This uses same OAuth strategy meteor does but appends instead of creates. Cool!