Meteor doesn't logout

I can’t logout with Meteor.logout(function(err){
console.log(“loginot”,err);
})

Do you get any error?

no it doesn’t execute

Meteor.logout(function(err){
console.log(“loginot”,err);
})

at all

i dont see the callback log that i did in the console

Are you doing this in the client? It’s a client-only function.

yes in the client i know it is a client only

did you try watching for exceptions?

try {
  Meteor.logout(function(err) {
    console.dir(err);
  });
} catch (exc) {
  console.dir(exc);
}

Also i looked in my Applications and found that I’m using Accounts.logout();, not Meteor.logout();. but thats probably just an alias.

I did

try {
  Meteor.logout(function(err) {
    console.dir(err);
  });
} catch (exc) {
  console.dir(exc);
}

but no error

You do have at least the accounts-base package in your app?

yes
import { Accounts } from ‘meteor/accounts-base’;

Are you sure that the you get there execution wise (just covering all the bases)? Where exactly are you calling it?

I meant did you do meteor add accounts-base or meteor add accounts-password, etc?

1 Like

Any answer please???

i just did some experimenting and the only scenarios i could reproduce the callback not firing at all was:

  • logout is not beeing called.
  • logout is called when you are already logged out

please try this code and tell us whats printed to the console when you click #logout

Template.header2.events({
  "click #logout": function(e) {
    e.preventDefault();
    console.log("trying to log out"); // checks if you even get here
    console.dir(Meteor.userId());  // checks if you are logged in properly

    try {
      Meteor.logout(function(err) {
        console.log("logout done");
        console.dir(err);
      });
    } catch (exc) {
      console.dir(exc);
    }
1 Like

For me the logout is not beeing called

Be cause the user still logged in

I cannot reproduce your issue.

Can you set up a minimum reproduction on github?

can you give me your email i will add you in the gitlab repo

Is that a minimum reproduction, or will I be expected to install your entire application?