function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MattLacey.ax1065MattLacey.ax1065 

OAuth Error using Mobile SDK for iOS

For an existing iPhone application which used old-school logins (i.e. required a token and stored user creds) I added OAuth support last week using code from the Mobile SDK preview.

 

It's been working perfectly until today, when I've had errors several times regarding failed JSON parsing when processing the response of a refresh request (see below). What's odd is that the JSON is perfectly valid according to jsonlint.com so I'm assuming there's a problem with the parsing that's happening in SFOAuthCoordinator. Anybody have any ideas of how to resolve this? It's preventing my from continuing with my development! (I know the SDK is a preview release but surely login shouldn't need to change?).

 

oauthCoordinator:didFailWithError: Error Domain=SFOAuthErrorDomain Code=668 "SFOAuthErrorDomain malformed_response : failed to parse response JSON" UserInfo=0x760d700 {error=malformed_response, NSLocalizedDescription=SFOAuthErrorDomain malformed_response : failed to parse response JSON, error_description=failed to parse response JSON, response_data={"id":"https://test.salesforce.com/id/00DO00000005SlNMAU/00590000000NZvLAAW","issued_at":"1320726727749","instance_url":"https://cs5.salesforce.com","signature":"bapfKpkvacGgWSEddD+buphb2W3Y2Rwaq40FBIrbERE=","access_token":"00DO00000005SlN!AR8AQLQofWLSElsO0xcyc4bnIdMe.vmoFz_Ua237NMtdEWO6KMgZW2rdNTEKsERFy3Df2Lxe1Cmh.QcWJ2jDHAtVaReXjDZI"}, NSUnderlyingError=0x760aa60 "SFOAuthErrorDomain malformed_response : failed to parse response JSON"}

 

 

Best Answer chosen by Admin (Salesforce Developers) 
MattLacey.ax1065MattLacey.ax1065

Having communted with a few of the SFDC guys managed to get this working by pulling down the latest code from the git repository, building that and then taking the newly built libraries from the dependancies folder.

All Answers

MattLacey.ax1065MattLacey.ax1065

More information:

 

Re-compiled with the revokeAuthentication method being called and I can confirm that still works, but removing that, recompiling and trying the refresh approach is still failing.

MattLacey.ax1065MattLacey.ax1065

Having communted with a few of the SFDC guys managed to get this working by pulling down the latest code from the git repository, building that and then taking the newly built libraries from the dependancies folder.

This was selected as the best answer
cwagnercwagner

I am getting the same issue and I just downloaded from GitHub today, any ideas?

 

2011-11-16 20:10:19.382 CRM360[59420:b603] SFOAuthCoordinator:authenticate: authenticating with refresh token on 'https://login.salesforce.com' ...
2011-11-16 20:10:20.764 CRM360[59420:b603] OAuth failed: Error Domain=com.salesforce.OAuth.ErrorDomain Code=668 "com.salesforce.OAuth.ErrorDomain malformed_response : failed to parse response JSON" UserInfo=0x59036b0 {error=malformed_response, NSLocalizedDescription=com.salesforce.OAuth.ErrorDomain malformed_response : failed to parse response JSON, error_description=failed to parse response JSON, response_data={"id":"https://login.salesforce.com/id/REMOVED/REMOVED","issued_at":"1321499420123","instance_url":"https://na8.salesforce.com","signature":"REMOVED","access_token":"REMOVED"}, NSUnderlyingError=0x591e930 "com.salesforce.OAuth.ErrorDomain malformed_response : failed to parse response JSON"}

Notice I inserted "REMOVED" where ids/tokens were present. 

cwagnercwagner

Ok, so it seems the compiled frameworks in the dependencies directory have not been updated in awhile to include the changes that have been committed. Why aren't these being updated?