Menu endpoint hangs when access callback returns false I'm trying to add a custom access callback function that checks that a user is a specific user (we only want this one api user to have this specific endpoint. It is set up like so:

function my_module_menu() {
    return array(
        '/api/v1/sample/request' =&gt; array(
            'page callback' =&gt; 'sample_request',
            'access callback' =&gt; 'user_is_api_user',
            'type' =&gt; MENU_CALLBACK,
        )
    );
}

function user_is_api_user() {
    watchdog("GLOBALS", "&lt;pre&gt;" . print_r($GLOBALS['user'], true) . "&lt;/pre&gt;");
    return $GLOBALS['user']-&gt;name == 'api';
}


If my custom user_is_api_user function returns FALSE, the endpoint just hangs instead of sending back a 403 Forbidden (like expected). Instead, it looks it just keeps retrying because my recent logs just repeat the error not authorized and the watchdog log I put in over and over again until I end the request. 

If my custom user_is_api_user returns TRUE, it logs the user in fine. Why does it just look and not actually return 403 forbidden when my custom function return false?
To return 403 Forbidden in your callback function, use drupal_access_denied() function something like:

function user_is_api_user() {
  watchdog("GLOBALS", "&lt;pre&gt;" . print_r($GLOBALS['user'], TRUE) . "&lt;/pre&gt;");
  if ($GLOBALS['user']-&gt;name !== 'api'){
    drupal_access_denied();
  }
}