I can understand that this can be a bit confusing as it's not really documented very well. The key concept here is that forcClient
is an instance of react.force.net.js
var forceClient = require('./react.force.net.js');
When a user authenticates using oauth.authenticate
- under the hood, it returns a data dictionary comprising of
* Returns a dictionary with:
* accessToken
* refreshToken
* clientId
* userId
* orgId
* loginUrl
* instanceUrl
* userAgent
*/
The forceClient
reads this data dictionary and it has all the session information as well as target org/ user details available to fire subsequent SOQL operations using the query()
method
As an example
var soql = 'SELECT Id, Name FROM Account LIMIT 10';
forceClient.query(soql,
function(response) {
var users = response.records;
var data = [];
var count = 0;
for (var i in users) {
data.push(users[i]["Name"]);
count++;
}
I hope that answers your question. I'd recommend watching this video to understand this in further detail.