Easwaramoorthy Kanagaraj
Easwaramoorthy Kanagaraj

Reputation: 4213

Salesforce OAuth Access_Token null?

I am trying to implement the rest api sample given in the salesforce site link below.

http://wiki.developerforce.com/page/Getting_Started_with_the_Force.com_REST_API

I have set up project as said in the link, but when I am executing the project I am getting an error as "Error - no access token". When I do debug, I came to know that the variable accessToken is null.

String accessToken = (String) request.getSession().getAttribute("ACCESS_TOKEN");

I am bit confused about this problem.

Please help me in this regard.

Upvotes: 1

Views: 991

Answers (1)

Amin Y
Amin Y

Reputation: 751

It seems you are missing this part in your code:

// Set a session attribute so that other servlets can get the 
// access token
request.getSession().setAttribute(ACCESS_TOKEN, accessToken); 

// We also get the instance URL from the OAuth response, so set it
// in the session too
request.getSession().setAttribute(INSTANCE_URL, instanceUrl);

Upvotes: 2

Related Questions