0
dev 포럼에서 본 예제 중 하나를 사용하여 OAuth 및 표지판을 사용하여 Evernote에 연결하려고하지만 어떤 이유로 든 오류 코드 400 (잘못된 요청)이 계속 표시됩니다. 여기Error code 400 with Evernote OAuth (푯말)
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
String consumerKey = "key_here";
String consumerSecret = "secret_key_here";
OAuthConsumer consumer = new DefaultOAuthConsumer(consumerKey,
consumerSecret);
consumer.setMessageSigner(new PlainTextMessageSigner());
OAuthProvider provider = new DefaultOAuthProvider(
"https://sandbox.evernote.com/oauth",
"https://sandbox.evernote.com/oauth",
"https://sandbox.evernote.com/OAuth.action") {
private static final long serialVersionUID = 1L;
@Override
protected HttpRequest createRequest(String endpointUrl)
throws MalformedURLException, IOException {
HttpURLConnection connection = (HttpURLConnection) new URL(
endpointUrl).openConnection();
connection.setRequestMethod("GET");
connection.setAllowUserInteraction(false);
connection.setRequestProperty("Content-Length", "0");
return new HttpURLConnectionRequestAdapter(connection);
}
};
String authUrl = provider.retrieveRequestToken(consumer,
OAuth.OUT_OF_BAND);
System.out.println(authUrl);
}
(누군가가 요청하기 전에, 그래 난 내 자신의 키를 사용하여 자리를 대체 않았다) 그리고 오류입니다 :
Exception in thread "main" oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: Service provider responded in error: 400 (Bad Request)
at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:218)
at oauth.signpost.AbstractOAuthProvider.retrieveRequestToken(AbstractOAuthProvider.java:74)
at com.zakta.evernote.module.EvernoteAuthenticationTest.main(EvernoteAuthenticationTest.java:44)
Caused by: oauth.signpost.exception.OAuthCommunicationException: Service provider responded in error: 400 (Bad Request)
at oauth.signpost.AbstractOAuthProvider.handleUnexpectedResponse(AbstractOAuthProvider.java:245)
at oauth.signpost.AbstractOAuthProvider.retrieveToken(AbstractOAuthProvider.java:193)
... 2 more
내가 올바른를 사용하는 것 여기에 코드입니다 여기에 절차가 있었지만, 아마도 뭔가 바뀌었을까요? 도움에 감사드립니다.