0

I am using OAuth2 for connecting my app with user's salesforce account. I am making authorization request with success and getting following things in response

  1. access_token
  2. instance_url
  3. id
  4. issued_at
  5. signature
  6. scope
  7. token_type: Bearer

When I am trying to fetch salesforce data with following code

Dim binding As sforce.SforceService
binding = New sforce.SforceService()
binding.SessionHeaderValue = New sforce.SessionHeader()
binding.SessionHeaderValue.sessionId = <<access_token>> ' This is obtained by above step
binding.Url = <<id>> ' This is obtained by above step
dgr = binding.describeSObject("case")

I am getting exception

INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session hash: dGNP7MWaYz4kTAATqdvCAQk8H5NxD/xw/L+PpuPMpFA= This error usually occurs after a session expires or a user logs out.

How can I fix it? I am sure I am passing something wrong but can't figure out what.

1

binding.Url should be the instance_url and not the Id.

SRC: https://developer.salesforce.com/page/Integrating_Force.com_with_Microsoft_.NET

We only need 2 params to make successive calls, sessionId and serverURL. As you are using Oauth2 to get access token it also gives you server_url in the form of instance_url.

| 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.