meteormeteor-blazemeteor-accountsmeteor-helper

MeteorJS Logging in User with User Object


I have user object from database in my Blaze Helper file:

Object {_id: "mFx4Fa8aPpoFweziq", services: Object, emails: Array[1], profile: Object}

I want to login this user using above object which contains email as well as hash password.

I have following accounts packages: accounts-password accounts-ui


Solution

  • You can login with the loginToken saved inside services.resume.loginTokens

    Get the token from the array of tokens and use the following method

    Meteor.loginWithToken(token, callback)

    check here

    that is how meteor reads the value from localstorage and automatically log you in when you re-open the website

    If you don't have access token you can create one, check this