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);
我试图使用上面的函数获取用户的id,但它不起作用。
答案 0 :(得分:2)
使用此格式https://na1.salesforce.com/id/1/1
的链接
na1 - salesforce instance,first 1 - organizationId,next 1 - userId。
注意,在这样的get中你应该被记录(提供OAuth令牌)。
我认为你在URL中提供的实际userId,或者在token和id之间有映射。