Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loginWithToken #325

Open
zyonnetworks opened this issue Sep 16, 2018 · 1 comment
Open

loginWithToken #325

zyonnetworks opened this issue Sep 16, 2018 · 1 comment

Comments

@zyonnetworks
Copy link

Please add this function to '/node-modules/react-native-meteor/src/user/User.js' so that we can use Meteor.loginWithToken

loginWithToken(value, callback) {
    Data._tokenIdSaved = value;
    if (value !== null) {
      this._startLoggingIn();
      call('login', { resume: value }, (err, result) => {
        this._endLoggingIn();
        this._handleLoginCallback(err, result);
        typeof callback == 'function' && callback(err);
      });
    } else {
      this._endLoggingIn();
    }
  },
@ChrisKG32
Copy link

ChrisKG32 commented Oct 22, 2018

@zyonnetworks It is not documented, but after some digging I found that Meteor._loginWithToken works just fine. This is only available on the client, so I recommend you make a method that returns Accounts._generateStampedLoginToken() for the token needed.

It would look something like this:
//Server
const stampedToken = Accounts._generateStampedLoginToken();

//Client
//import Meteor from 'react-native-meteor';
Meteor._loginWithToken(stampedToken.token);

Hope that helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants