FlowRouter when routing depends on a subscription

I’m writing a licence validation part for my application and want to redirect the user to a renewal page if and only if their licence has expired.

I am using FlowRouter and Blaze.

All my authenticated routes are in a group:

let authenticated = FlowRouter.group({
  triggersEnter: [checkAuthenticated, checkSubscription]

I then check if the subscription is valid like so:

const checkSubscription = function(context){
  let path = FlowRouter.current().path;
  if (!Meteor.userId()){
  const sub = new Subscription();
  if (sub.isInvalid() && path !=="/manage-practice/subscription"){

My class subscription uses a collection that I can only load once a user has logged in. My problem is that the router usually triggers this redirection before this data has been loaded.

I’ve been thinking a number of option how to best implement this, but was wondering if there is a best practice approach.

The options I’m considering are:

  • Call a server side method on each redirect (probably slow), but a valid licence could be cached in the session.
  • Call an intermittent page and then redirect.

I personally prefere to handle these cases (not logged in, not authorized, no licence, etc.) not through routes, but through the layout.

e.g. an example in react, this would be the MainLayout that is shared between every route. Blaze would be similar, i guess.

// content would be the inner content of the page, that would visible, if everything would be ok

const MainLayout = ({content}) => {
  if( notLoggedIn ) {
    return <LoginForm />
  if( licenceInvalid) {
    return <LicenceExpired />
  return content;


  • no need to redirect after licence has been renewed
  • no reload needed