• robboerman
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies

Hello,

 

We are developing a HTML5 hybrid app that uses the hybrid SDK for authentication. Everytime we install the app on the iPad and use the OAUTHPlugin to authenticate with Salesforce we get the following error:

 

Aug 28 10:26:14 unknown fieldbuddy[8548] <Warning>: *** WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSInternalInconsistencyException> credentials.clientId cannot be nil or empty

 

The authenticate method is called correctly like so:

 

PhoneGap.exec(success, fail, "com.salesforce.oauth", "authenticate", [JSON.stringify(oauthProperties)]);

 

With oauthProperties being (CHANGED keys for privacy):

{"remoteAccessConsumerKey":"3MV***************************","clientId":"3MV**********************","oauthRedirectURI":"testsfdc:///mobilesdk/detect/oauth/done","oauthScopes":["web","api"],"autoRefreshOnForeground":true}

 

When we go to the iPad settings, set 'Logout Now' to 'on' and go back to the app, suddenly the OAuth screen pops up. 

 

Can anyone tell me why the authenticate method in the SDK complains about a missing clientId when we do provide it in every call?

 

Thanks, 
Rob

Hi, 

 

We are integrating a hybrid app with the REST API but are getting random errors from SalesForce. I have logged 2 instances of the app running in which a call is correctly handled and another where an error is returned by the REST API. The thing is... the 2 calls seem to be identical aside from an AccessToken that has been refreshed already and a single attribute (lastModified date) in the query.

 

The REST API complains that the Entity Body is empty when in fact I think that is always empty in a GET call. Can anyone help me out? This is realy driving me bonkers because it seems to go wrong at random intervals

 

CALLS: (OAUTH token removed)

Call correctly handled: 

 

{
"request": {
"id": null,
"headers": {
"Authorization": "OAuth *************************************",
"X-User-Agent": "salesforce-toolkit-rest-javascript/v24.0",
"X-Requested-With": "XMLHttpRequest"
},
"options": {
"method": "GET",
"url": "https://cs13.salesforce.com/services/data/v24.0/query?q=SELECT%20Id%2C%20OwnerId%2C%20IsDeleted%2C%20Name%2C%20CreatedDate%2C%20CreatedById%2C%20LastModifiedDate%2C%20LastModifiedById%2C%20SystemModstamp%2C%20FIELDBUDDY__Date__c%2C%20FIELDBUDDY__User__c%2C%20FIELDBUDDY__Total_Mileage__c%2C%20FIELDBUDDY__Total_Time_Hours__c%2C%20FIELDBUDDY__Total_Time_Minutes__c%20FROM%20FIELDBUDDY__Timesheet__c%20WHERE%20%28%20FIELDBUDDY__USER__C%20%3D%20%2700520000001DD9eAAG%27%20%29%20%20AND%20LastModifiedDate%20%3E%202012-08-22T22%3A23%3A59.068Z",
"disableCaching": true,
"headers": {
"Authorization": "OAuth *************************************",
"X-User-Agent": "salesforce-toolkit-rest-javascript/v24.0"
},
"jsonData": ""
},
"async": true
},
"requestId": null,
"status": 200,
"statusText": "OK",
"responseText": "{\"totalSize\":0,\"done\":true,\"records\":[]}",
"responseXML": null
}

 

 

Call resulting in an error:

 

{
"request": {
"id": null,
"headers": {
"Authorization": "OAuth *************************************",
"X-User-Agent": "salesforce-toolkit-rest-javascript/v24.0",
"X-Requested-With": "XMLHttpRequest"
},
"options": {
"method": "GET",
"url": "https://cs13.salesforce.com/services/data/v24.0/query?q=SELECT%20Id%2C%20OwnerId%2C%20IsDeleted%2C%20Name%2C%20CreatedDate%2C%20CreatedById%2C%20LastModifiedDate%2C%20LastModifiedById%2C%20SystemModstamp%2C%20FIELDBUDDY__Date__c%2C%20FIELDBUDDY__User__c%2C%20FIELDBUDDY__Total_Mileage__c%2C%20FIELDBUDDY__Total_Time_Hours__c%2C%20FIELDBUDDY__Total_Time_Minutes__c%20FROM%20FIELDBUDDY__Timesheet__c%20WHERE%20%28%20FIELDBUDDY__USER__C%20%3D%20%2700520000001DD9eAAG%27%20%29%20%20AND%20LastModifiedDate%20%3E%202012-08-22T21%3A27%3A24.515Z",
"disableCaching": true,
"headers": {
"Authorization": "OAuth *************************************",
"X-User-Agent": "salesforce-toolkit-rest-javascript/v24.0"
},
"jsonData": ""
},
"async": true
},
"requestId": null,
"status": 400,
"statusText": "Bad Request",
"responseText": "[{\"message\":\"The HTTP entity body is required, but this request has no entity body.\",\"errorCode\":\"JSON_PARSER_ERROR\"}]",
"responseXML": null
}

The currently served SF login page for touch devices (login.salesforce.com?display=touch) is triggering a really bad UI bug on ios7 webkit view.

Note that this only happens for app that uses their on UIWebView, not iOS7 Safari.

 

You can reproduce the problem easily. Create a new iOS app that just has a single view, and add a webview to it.

The viewDidLoad method can be as simple as:

 

- (void)viewDidLoad

{

    [superviewDidLoad];

    NSString *address = @"https://login.salesforce.com?display=touch";

    NSURL *url = [NSURL URLWithString:address];

    NSURLRequest *request = [NSURLRequest requestWithURL:url];

    [self.webViewloadRequest:request];

}

 

When you start the app, the login page looks fine. But if you tap on the "User name" field, the UIWebView will fail to set focus.

Tap again, it might shift the page up a few pixels. Tap again, it'll set focus to the password field. Tap again, and you might get foucs finally on the username field. 

 

This appears to be a bug in ios7. If you have an ios developer forum account, you can read the discussion here:

https://devforums.apple.com/message/887376#887376

There are simple test cases on that thread that illustrate the bug. 

There is also a simple workaround for the problem mentioned in that thread:

 

If the HTML returned from login.salesforce.com change the embedded meta tag from this:

 

<meta name="viewport" content="initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />

 

to this

 

<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, target-densityDpi=device-dpi" />

 

it will load fine. Verified by serving that page to a UIWebView.

 

Given that the SF meta tag has a typo in it anyway (semicolons instead of commas), it'd be GREAT if Salesforce could be the "bigger person" here and fix their HTML by adding the few characters here to be compatible with the new ios7 webkit (rather than having to wait for an ios OS upgrade that fixes the issue).

 

Because logging into SF is often the first step for partner app, this bug looks awful to our users; a fix would be really, realy appreciated.

 

Looking forward to a response from folks inside SF who can help.

-ck

 

 

 

 

 

  • October 26, 2013
  • Like
  • 0