I'm trying to login users using Google OpenID.
When I try to authenticate a user, I always run into a timeout when trying to retrieve the AccessToken.
public class TestRun {
public static void main(String args[]) throws OAuthSystemException, OAuthProblemException {
OAuthClientRequest request = OAuthClientRequest
.tokenProvider(OAuthProviderType.GOOGLE)
.setGrantType(GrantType.AUTHORIZATION_CODE)
.setCode("")
.setRedirectURI(Env.REST_API_LOCATION+"/login")
.setClientId(Env.CLIENT_ID)
.setClientSecret(Env.CLIENT_SECRET)
.buildQueryMessage();
OAuthClient oac = new OAuthClient(new URLConnectionClient());
OAuthAccessTokenResponse response = oac.accessToken(request);
System.out.println(response.getAccessToken());
System.out.println(response.getExpiresIn());
}
}
I always run into a ConnectException (timeout) when oac.accessToken(request) is called and don't get any more info about what's happening.