GAM Google Authentication Type

This paper is valid for GeneXus X Evolution 3 upgrade 4 and upper. For other versions see here.

Using GeneXus Access Manager you can authenticate in Google site, just by following these steps:

1. You need to create a "Google client application" in Google site and obtain Client Id and Client Secret for that application.

Go to the following link: https://code.google.com/apis/console

2. There go to API Access section; first click on the Credential section, and select "OAuth Client id":

googlesettings1


Select "Application Type" = Web Application

googlesettings2 


Finally, you need change the Redirect URIs. There you may specify the complete URI of your application, including the /oauth/gam/signin, as the figure shows:

ClientOAuthAppGoogleCreateClientID2


Important note

In all cases - Java and NET-, you need to specify the complete URI of the application including the virtual directory followed by /oauth/gam/signin

Configuration to be done in the GAM Backend

Define a new Authentication Type = Google using the GAM Web Backoffice.

Enter Cliend Id and Client Secret obtained in Google site.

GoogleAuthTypeGAMBackend2

Important note:

In Java and Net you need to enter the complete site URL in CallBack URL, including the virtual directory.

For example: http://apps2.genexusx.com/Ide1b858bf3b044ba0ac777119780e4370

Do not include the "/servlet" in java.

How to login using Google account in WEB applications

In case of Web Applications, the GamExampleLogin object (which is part of the GAM example library) includes automatically a button by which the user can login to Google.
This button is included dynamically, as the Google Authentication Type is detected to be defined in the GAM Repository.

GoogleLogin

The following code is associated to the "Google" Button:

Event &ButtonGoogle.Click
GAMRepository.LoginGoogle()
EndEvent

How to login using Google account in SD applications

The following code is used for that purpose:

Event 'Google'
 SDActions.LoginExternal("google", &User, &Password)
EndEvent

See Also

GAM Facebook Authentication Type (X Evolution 3 upgrade 3 and prior)
GAM Twitter Authentication Type
Additional Scope Property for GAM Google / Facebook Authentication Types