Meteor 1.2.2 , Accounts.setPassword does not find the user id

Trying to use Accounts.setPassword on server side using a method

       userProfile = Accounts.findUserByEmail(email);
        console.log("supplied email is ....", email);
        console.log(" user is ..", userProfile._id);
        if (userProfile){   
       var passwordset = Accounts.setPassword(userProfile._id, '8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92', {logout: false});

            console.log("password set value is ....", passwordset);
            if (passwordset){
                return true;

At first i passed a plain text password as newPassword , and i got the error that only SHA-256 is allowed , so i am passing a SHA-256 Hash , seems like it tries to set , but then what I see is passwordset is undefined. and password is not being set …

What am i missing here? Any help would be greatly appreciated.


Ok , apparently function Accounts.setPassword(‘userid’, ‘newpassword’) accepts string parms for userid and newpassword, in my case i was generating a token which was a int value and when i passed that it complained about the SHA-256 , and when i cast it to string , token.toString(); got rid of the SHA-256 Error i was receiving.

Also , why is the return value of Accounts.setPassword undefined?
if i have soemthing like var passwordset = Accounts.setPassword (userid, password);
console.log(passwordset) ----> prints undefined…

how can i confirm password was indeed set ?

Any thoughts?