When using the default created service, some PHP notices are logged:

Notice: Undefined property: stdClass::$debug in services_endpoint_callback() (line 195 of/var/www/dev.sandbox2.vito.local/sites/all/modules/services/services.module).
Notice: Undefined property: stdClass::$server_settings in services_endpoint_callback() (line 196 of/var/www/dev.sandbox2.vito.local/sites/all/modules/services/services.module).
Notice: Undefined property: stdClass::$debug in services_endpoint_callback() (line 198 of/var/www/dev.sandbox2.vito.local/sites/all/modules/services/services.module).

This can be fixed by providing a slightly completer service endpoint definition in oauthloginprovider.services.inc:
The code below is a full export of the overridden service. I marked the two important things with a comment behind it.

$endpoint = new stdClass();
$endpoint->disabled = FALSE; /* Edit this to true to make a default endpoint disabled initially */
$endpoint->api_version = 3;
$endpoint->name = 'oauthlogin';
$endpoint->server = 'rest_server';
$endpoint->path = 'oauthlogin/api';
$endpoint->authentication = array(
  'services_oauth' => array(
    'oauth_context' => 'oauthlogin',
  ),
);
$endpoint->server_settings = array(              /* This one */
  'rest_server' => array(
    'formatters' => array(
      'bencode' => TRUE,
      'json' => TRUE,
      'php' => TRUE,
      'rss' => TRUE,
      'xml' => TRUE,
      'yaml' => TRUE,
      'jsonp' => FALSE,
    ),
    'parsers' => array(
      'application/json' => TRUE,
      'application/vnd.php.serialized' => TRUE,
      'application/x-www-form-urlencoded' => TRUE,
      'application/x-yaml' => TRUE,
      'multipart/form-data' => TRUE,
    ),
  ),
);
$endpoint->resources = array(
  'oauthlogin' => array(
    'alias' => 'user',
    'actions' => array(
      'info' => array(
        'enabled' => 1,
        'services_oauth' => array(
          'credentials' => 'token',
          'authorization' => 'user_info',
        ),
      ),
    ),
  ),
);
$endpoint->debug = 0;        /* This one */
CommentFileSizeAuthor
#1 1789940.patch1023 bytesmatt2000

Comments

matt2000’s picture

Priority: Minor » Critical
Status: Active » Needs review
StatusFileSize
new1023 bytes

Here's a patch of the above, further refined. The alias 'user' causes bugs in the Services UI (I assume because of the conflict wiht the built-in user resource), so I've renamed it to 'login'.

Bumping priority to critical, since the module doesn't really work as advertised without this fix.

  • Commit afe8222 on 7.x-1.x by matt2000:
    #1789940 by matt2000: Fix default service
    
matt2000’s picture

Status: Needs review » Fixed

Fixed in 7.x-1.2-beta

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.