title: Getting an OAuthProblemException: invalid_request for Google when using OLTU
body: <p>I'm using the Oltu library from Apache and I'm trying to authenticate via Google using OAuth2.  Here's the relevant code:</p>
  
  <pre><code>OAuthAuthzResponse oar = OAuthAuthzResponse.oauthCodeAuthzResponse(request);
  OAuthClientRequest clientReq = OAuthClientRequest
      .tokenProvider(OAuthProviderType.GOOGLE)
      .setClientId("&lt;my-client-id&gt;")
      .setClientSecret("&lt;my-client-secret&gt;")
      .setRedirectURI("https://test.example.com/oauthtest/oauth/google/auth")
      .setCode(oar.getCode())
      .setGrantType(GrantType.AUTHORIZATION_CODE)
      .buildQueryMessage();
  
  OAuthClient oAuthClient = new OAuthClient(new URLConnectionClient());
  
  // This call fails with the OAuthProblemException
  OAuthAccessTokenResponse oAuthResponse = oAuthClient.accessToken(clientReq, 
          OAuthJSONAccessTokenResponse.class);
  </code></pre>
  
  <p>I can authenticate via Facebook without an issue, but for whatever reason this is failing.  I can get the code from the OAuthAuthzResponse without issue so I know the original call is working, but this follow-up call is failing.</p>
  
  <hr>
  
  <p><strong>Edit:</strong> I've given up on using Oltu and stuck with the simpler approach of using the HttpClient library and performing the OAuth dance by hand.  It's worked better for me and I would recommend it to anyone who wants to authenticate against more than one OAuth provider reliably.  Only Twitter required me to use <a href="https://github.com/fernandezpablo85/scribe-java" rel="nofollow">Scribe</a>.</p>