var SalesforceOAuthPlugin = {
/**
* 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.
* PhoneGap returns a dictionary with:
* accessToken
* refreshToken
* clientId
* userId
* orgId
* loginUrl
* instanceUrl
* userAgent
*/
getAuthCredentials: function(success, fail) {
PhoneGap.exec(success, fail, "com.salesforce.oauth","getAuthCredentials",[]);
},
SalesforceOAuthPlugin.getAuthCredentials(getUserid(), getAuthCredentialsError);
I am trying to get the id of the user using the above function, but its not working.
Use link of this format
https://na1.salesforce.com/id/1/1na1 – salesforce instance, first 1 – organizationId, next 1 – userId.
Note, that in such get you should be logged (provide OAuth token).
I think that actual userId you provide in URL, or have mapping between token and id.