I was looking at this thread for clues, but I noticed in a production app that I’ve been using this.userId()
for some time with no problem. However, when I migrated my app from 1.0.2 to 1.1.0.2, this.userId()
as returning undefined. I noticed that in this release the core Accounts package has changed. Any idea what might be causing this?
Here’s the method where I keep falling into the else:
Meteor.methods({
reauthenticateUser: function() {
var user = null;
if (this.userId) {
var hashedToken = Accounts._getLoginToken(this.connection.id);
user = Meteor.users.findOne({$and: [{'_id': this.userId}, {'services.resume.loginTokens': {$elemMatch: {hashedToken: hashedToken}}}]});
// reauth user
} else {
logger.error('No userId available. Please try again.');
throw { name: 'System Error', message: 'No userId available. Please try again.'
};
}
return user;
}
)}