Sessions not being resumed after Meteor server restart

Viewed 28

I am using ionic/angular with a meteor backend. Everything has been going smooth, but I am currently testing the authentication and have noticed that the user is logged out every time the server is restarted. I didn't notice this issue with standalone Meteor.

The Meteor.loginToken and Meteor.loginTokenExpires values are set in the browsers local storage and there are tokens in the services.resume.loginTokens property in the users collection in MongoDB.

Meteor 1.10.2 Angular 7.3.9

This is my login function:

    async login(email, password) {
        return new Promise((resolve, reject) => {
            Meteor.loginWithPassword(email, password, (error) => {
                if (error) {
                    this.toastService.present(error.reason, "danger");
                    return reject(error);
                }

                this.toastService.present("Login successful");
                resolve();
            });
        });
    }

The login works fine, but upon restarting the server, Meteor.user() returns null. Any suggestions?

0 Answers
Related