meteor - Login to get @userId from server -


i trying write test code using mocha meteorjs. had method uses @userid. acquired when user logs in. doing server side testing , wanted add @userid explicitly failed, can accessible within methods. , tried login using meteor.loginwithpassword reference http://docs.meteor.com/#/full/meteor_loginwithpassword. throws error.

object # has no method 'loginwithpassword'

by testing came know method accessible client side.

so question - how login server side code? or there way initialize @userid explicitly outside method inside server side code?

thanks advance.

there isn't native way authenticate user server-side meteor.

i'd suggest running meteor.loginwithpassword() on client , pairing meteor.validateloginattempt() server side, allow access user object (and therefore, userid) amongst other things.


Comments