Logging a user in with other than loginWithPassword


#1

I am creating a new mobile API in 1.3 with Restivus, and I am incorporating an SMS integration, which validates the user’s phone number. So there’s no reason I need to log a user in with password? Is there another method out there?

Thanks,
Patrick


#2

OK i figured out, first import Accounts

import {Accounts} from “meteor/accounts-base”

then you can call these method helpers, and insert a user record the normal way…

authToken = Accounts._generateStampedLoginToken()
hashedToken = Accounts._hashLoginToken authToken.token

There’s no login callback necessary for me, since it’s a server side app only for my API.

Hope this helps anybody else.


#3

Adding this to be complete, it is not ?

Meteor.users.update(userId,
{$push: {‘services.resume.loginTokens’: hashStampedToken}}
);


#4

Take a look at setUserId https://docs.meteor.com/api/methods.html