+ Start a Discussion

Invalid Session Id : INVALID_SESSION_ID error



I am using curl tool to test the REST API calls and used the following steps:


1. Get Access token 

curl https://na12.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id=xxxxx" -d "client_secret=yyy" -d "username=<SFDC username>" -d "password=<password>+<security token>"


2. Received the following security token

"access_token": "zzzzzzz",
"id": "https://login.salesforce.com/id/00DU0000000HDZrMAO/005U0000000UhgQIAS",
"instance_url": "https://na12.salesforce.com",
"issued_at": "1352117575555",
"signature": "ocuTdQyKqBg84ga/1/MGvuwNnUfFBdQBpfwA//dwVwY="


3. curl -v https://na12.salesforce.com/services/data/v25.0/sobjects/Account/ -H "Authorization: OAuth zzzzzz"


I have received the following error: 

[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]


I have looked into the Solutions provided in this forum for this error. But none of them helped me. I am using a Java application using REST and it is working fine for the same SFDC developer account. 


Refer: http://boards.developerforce.com/t5/APIs-and-Integration/Invalid-Session-ID-from-REST-API/td-p/234773