You are not authorized to access this page with blocks displayed I made a custom module in Drupal 7 with a simple page.

I used hook_menu to make permission :

function mymodule_menu() {     
  $items = array();
  $items['prestart'] = array(
            'title'             =&gt; t('Prestart page'),
            'page callback'     =&gt; array('mymodule_show_page'),
            'access arguments'  =&gt; array('access content'),
            'access callback'   =&gt; 'mymodule_isUserAuthenticated',
            'type'              =&gt; MENU_NORMAL_ITEM,
  );
  return $items;
}


The function to check if the user is authenticated :

function mymodule_isUserAuthenticated() {
   if (!user_is_logged_in()) {
       return FALSE;
    }
     return TRUE;
  }
}


After I created block (admin/structure/block) and I added to the page.

Problem :
If I go on the page in a private navigation tab (so not connected), I can see You are not authorized to access this page but all blocks are displayed.

How can I fix it ?
You probably need to adjust the visibility settings of your blocks (see screenshot below). You can, for instance, restrict the visibility to authenticated users only.

It is also possible to do it programmatically. See this question, for some guidance.