日期:2014-05-17 浏览次数:20869 次
String requestToken = request.getParameter("oauth_token"); DoubanService myService = new DoubanService("subApplication", apiKey, secret); if(requestToken != null) { myService=(DoubanService) request.getSession().getAttribute("DoubanService"); // // step2 : user give the authorization and prepare to get the request token Cookie[] cookies = request.getCookies(); if (cookies == null) { System.err.println("request token secret not found in cookie"); return; } Cookie c = cookies[0]; // // set request token and token secret myService.setRequestTokenSecret(c.getValue()); myService.setRequestToken(requestToken); // // get request token [color=#FF0000]myService.getAccessToken();[/color]
net.oauth.OAuthProblemException at net.oauth.client.OAuthHttpClient.invoke(OAuthHttpClient.java:71) at net.oauth.client.OAuthClient.invoke(OAuthClient.java:96) at net.oauth.client.OAuthClient.invoke(OAuthClient.java:102) at com.google.gdata.client.douban.DoubanService.getAccessToken(Unknown Source) at com.art.action.UserAction.doubanLogin(UserAction.java:500) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) com.google.gdata.util.AuthenticationException: Unauthorized no auth at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:570) at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:559) at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:542) at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:521) at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:531) at com.google.gdata.client.Service.getEntry(Service.java:982) at com.google.gdata.client.Service.getEntry(Service.java:908) at com.google.gdata.client.douban.DoubanService.getEntry(Unknown Source) at com.google.gdata.client.douban.DoubanService.getAuthorizedUser(Unknown Source) at com.art.action.UserAction.doubanLogin(UserAction.java:505) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)