• Vadim Efimov
  • 0 Points
  • Member since 2015

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1
I am trying to use user-agent oauth flow for a REST API call but getting INVALID_SESSION_ID using curl after authenticating. Here are the steps I am following:
1. Make a call to salesforce login to get access token:
https://login.salesforce.com/services/oauth2/authorize?response_type=token&client_id=<CONSUMER KEY>&redirect_uri=https://Mysamplesite/returnurl.html
I get the following in the return URL after logining in:
https://mysamplesite/returnurl.html#access_token=<ACCESS TOKEN>&instance_url=https%3A%2F%2Fna16.salesforce.com&id=https%3A%2F%2Flogin.salesforce.com%2Fid%2F00Dj0000001sdROEAY%2F005j000000BU6JbAAL&issued_at=1423448917611&signature=nDdwrOErs%2B0JAQf9F8bBisFbKIm%2F8OlxC%2Bz917fZRbk%3D&scope=api+web+full&token_type=Bearer
2. I am using the ACCESS_TOKEN in the REST API call using CURL:
curl https://na16.salesforce.com/services/data/v20.0/ -H 'Authorization: Bearer <access_token>'

Getting the following error message:

[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]
Am I missing something?