I implemented the OAuth2 authentication using Apache OLTU libraries. It works but I handle manually the request token from RedirectURL.
step:
request = OAuthClientRequest.authorizationProvider(OAuthProviderType.GOOGLE)//authorizationProvider(OAuthProviderType.GOOGLE) .setState(OAuth.OAUTH_STATE) .setResponseType(OAuth.OAUTH_CODE) .setRedirectURI("http://localhost:8080") .setClientId(clientId) .setScope("https://www.googleapis.com/auth/drive") .buildQueryMessage();
Step:
OAuthClientRequest oAuthClientRequest = OAuthClientRequest.tokenProvider(OAuthProviderType.GOOGLE) .setGrantType(GrantType.AUTHORIZATION_CODE) .setClientId(clientId) .setClientSecret(clientSecret) .setRedirectURI("http://localhost:8080") .setCode(requestCode).buildBodyMessage();
Between the two-step, I need to handle automatically the extraction of the code. How can I implement in code this step?
I'm wont it not in a servlet, but in a Portlet.