JSF を使用した Web アプリケーションがあります。
私のページには、呼び出すボタンがありますdoTwitterLogin()
public void doTwitterLogin() {
try {
HttpServletRequest req = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
String url = req.getRequestURL().toString();
Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer("xxx", "xxx");
RequestToken requestToken = twitter.getOAuthRequestToken(url);
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("requestToken_token", requestToken.getToken());
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("requestToken_secret", requestToken.getTokenSecret());
FacesContext.getCurrentInstance().getExternalContext().redirect(requestToken.getAuthorizationURL());
} catch (Exception e) {
e.printStackTrace();
}
}
一部のデバッグ後に例外が発生しRequestToken requestToken = twitter.getOAuthRequestToken(url);
ます。
SEVERE: 401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the system clock is in sync.
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<error>Desktop applications only support the oauth_callback value 'oob'</error>
<request>/oauth/request_token</request>
</hash>