You need to sign in to do that
Don't have an account?
narwhal_
Force.com Workbook REST Example Issue
As I am going thru the Force.com Workbook, I reach the REST API example. I am using cURL with the following cmd:
curl -s -H 'Authorization: OAuth token ...'
https://na15.salesforce.com/services/data/v29.0/analytics/reports/00Oi0000004tH4I
But I am getting "INVALID_SESSION_ID"
The tutorial doesnt cover authenticating. Any ideas?
Hi ,
If your access_token is
abc123
then you need a http header ofAuthorization: OAuth abc123
in the request.http://stackoverflow.com/questions/6095352/salesforcce-rest-api-invalid-session-id-error
See the below links for more information,
http://developer.force.com/cookbook/recipe/interact-with-the-forcecom-rest-api-from-php
https://help.salesforce.com/apex/HTViewHelpDoc?id=remoteaccess_oauth_refresh_token_flow.htm&language=en
http://help.salesforce.com/apex/HTViewHelpDoc?id=connected_app_create.htm&language=en_US
http://www.modelmetrics.com/tomgersic/oauth-2-0-for-salesforce-com/
http://salesforce.stackexchange.com/questions/14865/issue-with-using-oauth-token-in-rest-api
Regards,
Ashish
Thanks for your reply.
Is access token same as security token? As an example, if my security token is: abcd12345 -- i am using the following:
curl -s -H 'Authorization: OAuth abcd12345' https://na15.salesforce.com/services/data/v29.0/analytics/reports/reportIdHere
And i get back:
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]
Hi,
See the description and follow the instruction in the link below,
Access Token
The access token is used by the client to make authenticated requests on behalf of the end user. It has a longer lifetime than the authorization code, typically on the order of minutes or hours. When the access token expires, attempts to use it will fail, and a new access token must be obtained via a refresh token.
In Force.com terms, the access token is effectively a SID or 'session', much like a session cookie on other systems, and should be protected against interception, for example by Transport Layer Security (TLS, aka SSL).
Note that if you want to use an OAuth token to access the Force.com Web UI on behalf of the user, either by setting a SID cookie or via the 'front door' URL (e.g.
https://na1.salesforce.com/secur/frontdoor.jsp?sid=<sid_value>
) you must includeweb
in the list of requested scopes - see the discussion on thescope
parameter in the web server flow section below.Obtaining an Access Token in a Native Application (User-Agent Flow)
Client applications, for example, JavaScript running in the browser or native mobile or desktop apps, run on a user's computer or other device. Such apps are able to protect per-user secrets, but, since they are widely distributed, a common client secret would not be secure. The user-agent flow allows these applications to obtain an access token:
http://wiki.developerforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com
Also, See below for further info,
http://wiki.developerforce.com/page/Getting_Started_with_the_Force.com_REST_API
http://salesforce.stackexchange.com/questions/18565/security-token-vs-session-id-vs-access-token
Regards,
Ashish
Im following the force.com workbook and reached the point where it talks about "Analytics REST API". so far book is great and they explained everything step by step and now im lost. They say go to "https://na1.salesforce.com/analytics/reports" and "https://na16.salesforce.com/services/data/v29.0/analytics/reports/" , mine is on na16. So i go there but it says invalid session id.
In next step they are running Curl -s -H command with oAuth token. Where am i supposed to run this command and how do i get oAuth token. Im totally lost with this book , can anyone please help. Thanks
Regards,
Harjeet
http://www.salesforce.com/us/developer/docs/workbook/forcecom_workbook.pdf
curl -s -H 'Authorization: Bearer<space><your_token>'