title: how to get access token using gdata in java
body: <p>I am developing a Java Application where I am implementing 3-legged OAuth using google gdata in Java. <strong>This application is registered on Google App Engine.</strong> At the first stage, I am getting the unauthorized request-token successfully. I am storing that token in session and create a link using createUserAuthorizationUrl(oauthParameters). Then on clicking the link, it redirect me to "Grant Access Page". </p>
  
  <p>Now, even though I grant access, it doesn't show me <a href="http://code.google.com/apis/accounts/images/OauthUX_nocallback.png" rel="nofollow">this page</a>. But, it redirects me to my callback url. However, this seems proper. But, it also doesn't add the entry under <a href="https://www.google.com/a/searce.com/IssuedAuthSubTokens" rel="nofollow">My Account</a>. Here, I am storing the oauth_token in session.</p>
  
  <p>When getting redirected, the url of that page contains oauth_token &amp; oauth_verifier, both ! Now, on this callback url, I have a submit button &amp; set action of for to an accessTokenServlet.java. The code of this servlet is as follow :</p>
  
  <p>Now I am sending request to fetch Access Token. My code is : </p>
  
  <pre><code>            GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
              oauthParameters.setOAuthConsumerKey(CONSUMER_KEY);
              oauthParameters.setOAuthConsumerSecret(CONSUMER_SECRET);
              oauthParameters.setOAuthType(OAuthParameters.OAuthType.THREE_LEGGED_OAUTH);
  
              GoogleOAuthHelper oauthHelper = new GoogleOAuthHelper(new OAuthHmacSha1Signer());
  
              oauthParameters.setOAuthToken(request.getSession().getAttribute("oauth_token").toString());
              oauthParameters.setOAuthTokenSecret(request.getSession().getAttribute("oauth_token_secret").toString());
  
              try {
                  String accessToken = oauthHelper.getAccessToken(oauthParameters);
                  out.println("Access Token : " + accessToken);
              } catch (OAuthException e) {
                  //System.out.print("Response Status : " + response.getStatus());
                  out.println("Exception : ");
                  e.printStackTrace();
                  return;
              }
  </code></pre>
  
  <p>While clicking on submit button, it prints "Access Token : " &amp; nothing ! No token returns !</p>
  
  <p>I am getting wrong at the stage of authorizing the request token itself. But, I am not getting, <strong>what problem got generated ?</strong></p>