I am creating a webservice in salesforce that communicates with an iOS client. The client has authenticated and received a token just fine. The app will call the web service as receive data. When logged in as a system administrator, the app runs smoothly. However, when logged in as a standard user the app fails with the following error:
2012-08-06 08:44:13.827 myApp[74075:fb03] Request Failed with Error: Error Domain=com.alamofire.networking.error Code=-1011 "Expected status code in (200-299), got 403" UserInfo=0x8246410 {NSErrorFailingURLKey=https://xxxx-full.cs3.my.salesforce.com/services/apexrest/mobileServices/v1/SystemDataRecords, NSLocalizedDescription=Expected status code in (200-299), got 403}, {
NSErrorFailingURLKey = "https://xxxx--full.cs3.my.salesforce.com/services/apexrest/mobileServices/v1/SystemDataRecords";
NSLocalizedDescription = "Expected status code in (200-299), got 403";
}
Obviously this makes me think that it has something to do with the sharing model. However, if the standard user attempts to pull the same data while logged in directly on salesforce.com there is no problem.
Any thoughts?
One way to rule out the sharing issue is to try changing your class definition to without sharing (or simply omit with sharing, since without sharing is the default).
global without sharing class MyWebService
{
...
}
Without seeing any of your code, I'd hazard a guess that it's just a sharing model issue. However, if, for example, your Apex code branches differently based on the active user's profile then this might be an issue too.