What steps will reproduce the problem?
I am generating Request Token with the following Code :
protected void processRequest(HttpServletRequest request, HttpServletResponse
response)
throws ServletException, IOException, FileNotFoundException, IOException, Base64DecoderException, InvalidKeySpecException, NoSuchAlgorithmException, OAuthException {
// response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
String CONSUMER_KEY = "www.google.com";
GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
oauthParameters.setOAuthConsumerKey(CONSUMER_KEY);
oauthParameters.setScope("https://docs.google.com/feeds/");
oauthParameters.setOAuthCallback("callbackUrl.jsp");
BASE64Encoder encoder = new BASE64Encoder();
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
keyGen.initialize(1024, random);
KeyPair pair = keyGen.generateKeyPair();
PrivateKey priv = (RSAPrivateKey) pair.getPrivate();
//PublicKey pub = pair.getPublic();
GoogleOAuthHelper oauthHelper = new GoogleOAuthHelper(new OAuthRsaSha1Signer(priv));
oauthHelper.getUnauthorizedRequestToken(oauthParameters);
String approvalPageUrl = oauthHelper.createUserAuthorizationUrl(oauthParameters);
System.out.println("Callback URL : " + approvalPageUrl);
/* TODO output your page here
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet requestServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet requestServlet at " + request.getContextPath () + "</h1>");
out.println("</body>");
out.println("</html>");
*/
} finally {
out.close();
}
}
This is giving me an error :
SEVERE: The log message is null.
com.google.gdata.client.authn.oauth.OAuthException: Error getting HTTP response
at com.google.gdata.client.authn.oauth.OAuthHttpClient.getResponse(OAuthHttpClient.java:76)
at com.google.gdata.client.authn.oauth.OAuthHttpClient.getResponse(OAuthHttpClient.java:44)
at com.google.gdata.client.authn.oauth.OAuthHelper.getUnauthorizedRequestToken(OAuthHelper.java:335)
at Oauth.requestServlet.processRequest(requestServlet.java:56)
at Oauth.requestServlet.doGet(requestServlet.java:88)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for
URL:
https://www.google.com/accounts/OAuthGetRequestToken?oauth_callback=callbackUrl.
jsp&scope=https%3A%2F%2Fdocs.google.com%2Ffeeds%2F&oauth_nonce=6077341098309&oau
th_signature_method=RSA-SHA1&oauth_consumer_key=www.google.com&oauth_timestamp=1
296198416&oauth_signature=h%2F0IlDlsMYy2HqXv%2FksrOX3XCm51IwwpoRMjgLwGOJXTwSbZkT
P%2FguIH7ZRXfL16DtHAlULhyyvqapCR3pSA%2BKqZdcr5kdHMHWlnRGglHQb54X%2BT8EOWPr9xTQOd
0DDbQrLvau6RJhhSFxov95mU2UDQa2vI%2FRoyVMpAGqNUi4c%3D
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
at com.google.gdata.client.authn.oauth.OAuthHttpClient.getResponse(OAuthHttpClient.java:66)
... 30 more
What is the expected output? What do you see instead?
approvalPageUrl
What version of the product are you using? On what operating system?
Windows XP.
What is the error with my code ?
Original issue reported on code.google.com by saranghd...@gmail.com on 28 Jan 2011 at 7:22
Original issue reported on code.google.com by
saranghd...@gmail.com
on 28 Jan 2011 at 7:22