How do I setup a redirect for signing out?

I’m using meteor-useraccounts/iron-routing to manage users, I want to be able to take the user to a different page when they sign out but it doesn’t provide sign out routes. What can I do redirect the user when they sign out?

Its not exactly what you are looking for, but i used FlowRouter, instead of iron routing…

Here you can do it like this:

if (Meteor.isClient) {

    Accounts.onLogin(function () {
        FlowRouter.go('loggeeeedINPAGE');
    });

    Accounts.onLogout(function () {
        FlowRouter.go('home');
    });
}

Thank you, I’m thinking of switching to FlowRouter altogether.

useraccounts has a logout hook option. For example:

AccountsTemplates.configure({
  ...
  onLogoutHook() {
    // Do something after logging out!
  }
  ...
});

You can wire up your redirect using this option.

1 Like