It is - https://www.googleapis.com/oauth2/v2/userinfo

Regards,
Jude.
Iowa Workforce Development – IT | 1000 E Grand Ave, Des Moines, IA  50319
(515) 281-3378 | 
ashwanth.tiburt...@iwd.iowa.gov<mailto:ashwanth.tiburt...@iwd.iowa.gov>

From: Saqib Ali [mailto:saqib.n....@seagate.com]
Sent: Friday, March 20, 2015 5:41 PM
To: user@oltu.apache.org
Subject: Re: Google OpenID Connect Authentication example

Ashwanth,

In your code sample, what is the value for the Constants.G_USERINFO_URL?

Thanks! :)

On Fri, Mar 20, 2015 at 10:13 AM, Tiburtius, Ashwanth [IWD] 
<ashwanth.tiburt...@iwd.iowa.gov<mailto:ashwanth.tiburt...@iwd.iowa.gov>> wrote:
Hi Saqib,

It is mentioned in the Oltu documentation. All that I have is

              <dependency>
                     <groupId>org.apache.oltu.oauth2</groupId>
                     <artifactId>org.apache.oltu.oauth2.client</artifactId>
                     <version>1.0</version>
              </dependency>

Regards,
Jude.
Iowa Workforce Development – IT | 1000 E Grand Ave, Des Moines, IA  50319
(515) 281-3378<tel:%28515%29%20281-3378> | 
ashwanth.tiburt...@iwd.iowa.gov<mailto:ashwanth.tiburt...@iwd.iowa.gov>

From: Saqib Ali [mailto:saqib.n....@seagate.com<mailto:saqib.n....@seagate.com>]
Sent: Friday, March 20, 2015 11:23 AM
To: user@oltu.apache.org<mailto:user@oltu.apache.org>
Subject: Re: Google OpenID Connect Authentication example

 Ashwanth,

Thanks for the response. Can you please tell me what maven artifacts and 
imports I need to use to run this code?

Thanks! :)

On Tue, Mar 17, 2015 at 8:53 AM, Tiburtius, Ashwanth [IWD] 
<ashwanth.tiburt...@iwd.iowa.gov<mailto:ashwanth.tiburt...@iwd.iowa.gov>> wrote:
Hi Saqib,

See if this helps:

Build request to redirect to Google.

OAuthClientRequest request = 
OAuthClientRequest.authorizationProvider(OAuthProviderType.GOOGLE)
                                                
.setClientId(Constants.G_CLIENT_ID
                                                
.setResponseType(OAuth.OAUTH_CODE)
                                                .setScope(Constants.G_SCOPE)
                                                
.setRedirectURI(Constants.OAUTH_REDIRECT_URL)
                                                buildQueryMessage();

Redirect to request.getLocationUri()

Get the auth code returned from Google after user signs in.
Get access token using the following.
OAuthClientRequest oAuthClientRequest = 
OAuthClientRequest.tokenProvider(OAuthProviderType.GOOGLE)
                                                                     
.setGrantType(GrantType.AUTHORIZATION_CODE)
                                                                     
.setClientId(Constants.G_CLIENT_ID)
                                                                     
.setClientSecret(Constants.G_CLIENT_SECRET)
                                                                     
.setRedirectURI(Constants.OAUTH_REDIRECT_URL)
                                                                     
.setCode(this.code).buildBodyMessage();

final OAuthAccessTokenResponse accessTokenResponse = 
oAuthClient.accessToken(oAuthClientRequest);
accessToken = accessTokenResponse.getAccessToken();

Get User info using the following.
final OAuthClientRequest bearerClientRequest = new 
OAuthBearerClientRequest(Constants.G_USERINFO_URL)
                                                                         
.setAccessToken(accessToken)
                                                                         
.buildHeaderMessage();

OAuthResourceResponse resourceResponse = 
oAuthClient.resource(bearerClientRequest,
OAuth.HttpMethod.GET, OAuthResourceResponse.class);
resourceResponse.getBody()


Regards,
Jude.
Iowa Workforce Development – IT | 1000 E Grand Ave, Des Moines, IA  50319
(515) 281-3378<tel:%28515%29%20281-3378> | 
ashwanth.tiburt...@iwd.iowa.gov<mailto:ashwanth.tiburt...@iwd.iowa.gov>

From: Saqib Ali [mailto:saqib.n....@seagate.com<mailto:saqib.n....@seagate.com>]
Sent: Monday, March 16, 2015 8:20 PM
To: user@oltu.apache.org<mailto:user@oltu.apache.org>
Subject: Google OpenID Connect Authentication example

Greetings,

Can anyone please send me a Google OpenID Connect Authentication example using 
the Oltu Open Connect library?

Thanks! :)


Reply via email to