I am using the salesforce rest api to access the salesforce account from my rails application. I created a remote access application and got the key N id. I was able to authenticate the user and get auth_token, instance url and all that. But when I send a request to "instance_url / services / data / v20.0" along with the access token, I get this error:
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]
I have a Salesforce account for developers and the API is enabled for all profiles except the Authenticated Site profile (which is not available).
Please help me with this?
I check the user with the following query
HTTParty.post "login.salesforce.com/services/oauth2/token";, :body=>{"grant_type"=>"authorization_code","code"=>"abc}","client_secret"=>"abc", "client_id"=>"abc","format"=>"json","redirect_uri"=>"localhost:3000/salesforce/callback";}
which returns the signature, id, instance_url, issu_at, access_token and refresh_token
HTTParty.get "ap1.salesforce.com/services/data/v20.0";, :headers=>{"Authentication"=>"OAuth access_token", "Content-Type"=>"application/json"}
which answers
[{"errorCode"=>"INVALID_SESSION_ID", "message"=>"Session expired or invalid"}]