Go Pro Sign Up Login

Buy Now and unlock this series

yours forever

Become a Pro and unlock everything




per month

Login & Logout Redirecting

In this Intermediate Meteor video tutorial, we write redirects to make sure the user is landing on the correct page when logging in or out. Subscribe for more free tutorials https://goo.gl/6ljoFc, more Intermediate Tutorials here: https://goo.gl/11JLL8


Become a pro to download code and videos


Gary Porter

over 2 years ago [edited]

I found if you include this in your main.js

Tracker.autorun(()=>{ if(!Meteor.userId()){ FlowRouter.go('home'); } else{ FlowRouter.go('recipe-book'); } });

it should work but you get a Malformed URI warning in console


almost 3 years ago [edited]

onLogin and onLogout apparently don't work anymore. The package auth-callbacks is no longer maintained and apparently doesn't work anymore. I've tried a couple of different ways to make it work but the callbacks simply are not being called anymore as of Meteor 1.8 (2019) What I did was simply add the SideNav to the HomeLayout and only rendering it when the user has loggedIn:

<template name='HomeLayout'>
    {{> Header}}
    {{#if loggedIn}}
    {{> SideNav}}
        <div class="billboard">
            <h2>Organize Your Meals</h2>

Want to join the conversation?

Become a Pro member today!