How to log in with my stytch (auth provider) into meteor app?

Hi there folks. Just started working with Meteor, and I have to integrate Stytch (auth provider like auth0) with an existing meteor app that has standard users stored in the DB. I am trying to use this function:

Accounts.callLoginMethod({
    methodArguments: [{stytch: {sub: result.provider_subject, userid: result.user_id}}],
    userCallback,
  })

After a successful authentication using stytch, to somehow try to link or transform this oauth session into the “meteor session”, but I’m not sure how this should work. Usually there are examples for google, facebook and so on, and auth0 has its own meteorjs library.

But in the case of Stytch or any other external auth providers, documentation is not very clear. Should I do something different or maybe pass different information into methodArguments in order to achieve this?

My guess is that I can use something from the successful oauth authentication like email or subject to match it with the email address stored in the Meteor users table, but not sure if this happens automagically or I should implement some sort of logic.

1 Like

Welcome to the Meteor forums!

Edit: after reading again I now understand your issue. The.problem is that your provider should document what they expect and the OAuth login in Meteor should comply to it. This is the same as in the accounts-* packages.

Is there any particular code where you got stuck which you can share?