2012-02-03 3 views
0

아래의 Salesforce 사이트 링크에있는 나머지 API 샘플을 구현하려고합니다.Salesforce OAuth Access_Token null?

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

링크에서 말했듯이 나는 프로젝트를 설정했지만, 내가 프로젝트를 실행하고 때 나는 "오류 - 토큰에 액세스 할 수 없음"과 같은 오류를 얻고있다. 디버깅을 할 때 accessToken 변수가 null이라는 사실을 알게되었습니다.

accessToken = 문자열 (String)을 request.getSession()의 getAttribute ("access_token은.");

이 문제는 다소 혼란 스럽습니다.

이 점에 대해 도와주세요.

+0

당신이 액세스 토큰을 얻을 수있는 초기 인증 요청을 수행 않았고, 당신이 세션에 토큰을 저장 않았다 다음을? – ggreiner

답변

1

그것은 당신이 당신의 코드에서이 부분을 누락 것 같다

// 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); 
관련 문제