It took me some time to figure this out but I finally got it. There are some problems with the current dev in combination with oauth authorisation. And some for service in general.
in the service_oauth file i changed the following:
$endpoint = array();
- if (isset($method['endpoint']['services_oauth'])) {
+ // grep the specific settings for this method
+ if (!empty($method['endpoint']['services_oauth']['credentials'])) {
$endpoint = $method['endpoint']['services_oauth'];
The isset doesn't work here. The key is always set but the value isn't there if you haven't specified it in the UI. If there is no value it should grep it the default. It didn't.
foreach ($endpoint->authentication as $auth_module => $settings) {
- if (isset($settings) && $auth_error = services_auth_invoke($auth_module, 'authenticate_call', $settings, $controller, $args)) {
+ if (!empty($settings) && $auth_error = services_auth_invoke($auth_module, 'authenticate_call', $settings, $controller, $args)) {
return services_error($auth_error, 401);
}
}
Again, the isset didn't work so changed it to empty. The problem was that the user object was rewriten due to the isset. So all the request you try to do using REST where as anonymous.
There are some more in the patch file.
Comment | File | Size | Author |
---|---|---|---|
#5 | services-oauth_login_fix-1986008-5.patch | 2.47 KB | Jerenus |
#1 | services-oauth_user_fix-1986008-1.patch | 3.23 KB | h3rj4n |
Comments
Comment #1
h3rj4n CreditAttribution: h3rj4n commentedAnd the patch.
This also contains the patch from #1985878: Parse error in user_resource.inc so I'll close that one.
Comment #2
h3rj4n CreditAttribution: h3rj4n commentedAnd this one now needs review.
Comment #3
kylebrowning CreditAttribution: kylebrowning commentedComment #4
marcingy CreditAttribution: marcingy commentedDoes this need to go into d7 first?
Comment #5
Jerenus CreditAttribution: Jerenus commentedReroll to 7.x-3.x.
Comment #6
ygerasimov CreditAttribution: ygerasimov commentedI cleaned up patch #5 (it had some not relevant changes to user resource) and committed it. Thanks!
Comment #7
h3rj4n CreditAttribution: h3rj4n commentedWhat happened to the D6 patch?
Comment #8
h3rj4n CreditAttribution: h3rj4n commentedOk, got it: https://drupal.org/node/2012982