I'm using the Oltu library from Apache and I'm trying to authenticate via Google using OAuth2. Here's the relevant code:
OAuthAuthzResponse oar = OAuthAuthzResponse.oauthCodeAuthzResponse(request);
OAuthClientRequest clientReq = OAuthClientRequest
    .tokenProvider(OAuthProviderType.GOOGLE)
    .setClientId("<my-client-id>")
    .setClientSecret("<my-client-secret>")
    .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);
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.
Edit: 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 Scribe.