Services module, custom endpoint & authentication I have a have setup a custom endpoint via services and a REST server the custom end point looks like this, 

https://website.local/api/v1/druaplsquare

The custom endpoint is built using the following code, 

drupalsqaure.module

function drupalsquare_services_resources() {
  $resources = array();
  $resources['drupalsquare'] = array(
    'operations' =&gt; array(
         'create' =&gt; array(
             'file' =&gt; array('type' =&gt; 'inc', 'module' =&gt; 'services', 'name' =&gt; 'resources/drupalsquare'),
             'callback' =&gt; '_job_resource_create',
             'args' =&gt; array(
                 array(
                     'name' =&gt; 'node',
                     'optional' =&gt; FALSE,
                     'source' =&gt; 'data',
                     'description' =&gt; 'The node data to create',
                     'type' =&gt; 'array',
                 ),
             ),
             'access callback' =&gt; '_drupalsquare_resource_access'
         ),
         'delete' =&gt; array(
             'file' =&gt; array('type' =&gt; 'inc', 'module' =&gt; 'services', 'name' =&gt; 'resources/drupalsquare'),
             'callback' =&gt; '_job_resource_delete',
             'args' =&gt; array(
                 array(
                     'name' =&gt; 'jobref',
                     'optional' =&gt; FALSE,
                     'source' =&gt; array('path' =&gt; 0),
                     'description' =&gt; 'The job reference to delete',
                     'type' =&gt; 'string',
                 ),
             ),
             'access callback' =&gt; '_drupalsquare_resource_access'
         ),
    ),
  );
  return $resources;
}


resources/drupalsquare.inc

&lt;?php

function _drupalsquare_resource_access() {
    return TRUE;
}

//function _drupalsquare_resource_retrieve($uid) {
//  $account = user_load($uid);
//
//  if (isset($account-&gt;data['checked_in'])) {
//      return array(
//          'uid' =&gt; $account-&gt;uid,
//          'name' =&gt; $account-&gt;name,
//          'last_checkin' =&gt; $account-&gt;data['checked_in'],
//      );
//  }
//  else {
//      return FALSE;
//  }
//}

function _drupalsquare_resource_checkin($JobReference, $date = NULL) {
    die(print_r($JobReference));
//  $account = user_load($uid);
//  $account-&gt;data['checked_in'] = is_null($date) ? REQUEST_TIME : $date;
//  user_save($account);
    return TRUE;
}

function _job_resource_create() {
    die("create");
}

function _job_resource_delete($jobref) {
    die("here");
}


I am making a cURL request this is endpoint, but I am first of all authenticating a user, and getting a token, I am then sending this token in the request header, however the endpoint above is returning, 


  Access denied for user anonymous


Can anyone see any reason as why this would be happening?
In your code
Replace 'file' =&gt; array('type' =&gt; 'inc', 'module' =&gt; 'services', 'name' =&gt; 'resources/drupalsquare'),
with 'file' =&gt; array('type' =&gt; 'inc', 'module' =&gt; 'NAME_OF_YOUR_MODULE', 'name' =&gt; 'resources/drupalsquare'),
It seems you're wrongly defining your INC file.