title: salesforce rest api INVALID_SESSION_ID error
body: <p>I am using salesforce rest api to access the salesforce account from my rails app.I created a remote access app and got the key N the id. I was able to authenticate the user and get the auth_token, instance url and all that. But, when I send request at "instance_url/services/data/v20.0" along with the access token , I get this error:</p>
  
  <pre><code>[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]
  </code></pre>
  
  <p>I have a developer salesforce account and have API enabled true for every profile, except for the "Authenticated website" profile(which is not accessible).</p>
  
  <p>Please, can anybody help me with this?</p>
  
  <p>I'm authenticating the user with following request</p>
  
  <pre><code>HTTParty.post "login.salesforce.com/services/oauth2/token";, :body=&gt;{"grant_type"=&gt;"authorization_code","code"=&gt;"abc}","client_secret"=&gt;"abc"‌​, "client_id"=&gt;"abc","format"=&gt;"json","redirect_uri"=&gt;"localhost:3000/salesforce/callback";}
  </code></pre>
  
  <p>which is returning signature, id, instance_url, issued_at, access_token and refresh_token</p>
  
  <pre><code>HTTParty.get "ap1.salesforce.com/services/data/v20.0";, :headers=&gt;{"Authentication"=&gt;"OAuth access_token", "Content-Type"=&gt;"application/json"}
  </code></pre>
  
  <p>which responds with </p>
  
  <pre><code>[{"errorCode"=&gt;"INVALID_SESSION_ID", "message"=&gt;"Session expired or invalid"}]
  </code></pre>