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
Quang VuQuang Vu 

store userId after oath in mobile sdk

Hi guys

 

I'm totally new to mobile development. I'm modifying the sample hybrid app SFDCAccounts to test out the REST api, but I don't know how to get my userId after successful logon. Would appreciate any help on this. There's a method that has the following comments, but how do I access the 'dictionary' that is returned?

 

/**
* Obtain authentication credentials, calling 'authenticate' only if necessary.
* Most index.html authors can simply use this method to obtain auth credentials
* after onDeviceReady.
* success - The success callback function to use.
* fail - The failure/error callback function to use.
* cordova returns a dictionary with:
* accessToken
* refreshToken
* clientId
* userId
* orgId
* loginUrl
* instanceUrl
* userAgent
*/
var getAuthCredentials = function(success, fail) {
cordova.exec(success, fail, "com.salesforce.oauth","getAuthCredentials",[]);
};

SoleesSolees

Which version of the Salesforce Mobile SDK are you using?  In the 1.2 i think, you could easy do that.