Using JSForce, I create a new connection using the access and refresh token like so:

new jsforce.Connection({
        oauth2: {
            clientId: clintId,
            clientSecret: clientSecret,
            redirectUri: redirectUrl
        instanceUrl: url,
        accessToken: oauth_access_token,
        refreshToken: oauth_refresh_token

I then want to use the bulk method to import data:

client.bulk.load(jobData, 'insert', salesforceData, function (err, rets) {
    if (err) return callback(err);

This returns the following error:

{ [Error: Invalid session id] name: undefined, code: 'InvalidSessionId' }

I don't know what I'm doing wrong here

  • 3
    How are you getting the access token and refresh token? – metadaddy Nov 13 '14 at 5:36
  • where is your conn.login function? – Chris Chen Jan 23 '18 at 4:36
  • i am also facing this same issue, any solutions for this? – Vinay Pandya Jun 28 '18 at 15:42

According to jsforce documentation, you also need to provide a handler for the refresh event:

conn.on("refresh", function(accessToken, res) {
  // Refresh event will be fired when renewed access token
  // to store it in your storage for next request

Are you doing this?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.