Simpleddp - How to keep user logged in?

Hey guys,

I am using @gregivy 's awesome simpleddp package and its simpleddp-plugin-login to connect a Vue app to a Meteor server.

However, I realized that after a user logs in, if I refresh the page or switch to a different route, server.userId is undefined and apparently the login is lost.

I’ve read a few other people complaining about this and it looks like the solution involves “saving the login token” somewhere in the Vue app. Now I’ll be honest here: I have no idea what this is supposed to mean, how to do it and how to handle logins this way.

Could anybody help me out?


Meteor.loginToken is held in local storage. You can inspect using Chrome dev tools via the “Application” tab.

1 Like

Hello @patrickcneuhaus!

Try this:

server.on('login', (m) => {
  localStorage.set('auth_token', server.token);

Then when the page is ready you should check if there is an auth_token:

let auth_token = localStorage.get('auth_token');
if (auth_token) {
  // you have the token
  try {
    await server.login({resume:auth_token});
  } catch(e) {
   //something went wrong, maybe the token is too old or not valid
} else {
  // you don't have the token, user should authorize


Thanks for the reply! One question though: Is this going to work on mobile?

Do you mean cordova app? It will work anywhere, if the env has something like localStorage.

Great! It works here.

The only problem is that I keep getting “logged out” after a minute… can I change the default token time?

I am not sure this happens due to token time. By default it is much more than a minute (I’m not sure about the exact time). Login plugin resumes authorization automatically in case of connection drops etc, so it is probably not a case for the problem.

Can you provide a reproduction code for this behavior?


I managed to get this issue solved, but… am having trouble with Accounts-related functions.
Login works fine, but createUser doesn’t. Any idea why?


import { server } from "../main.js";
          email: email,
          password: password,
          profile: {
            customerId: customerId
        .then(() => {

There is no such function as createUser(). The easiest way is to create a special method on the server side for user creation.