Interact with Google APIs using GAM

Unofficial Content

Using Additional Scope Property for GAM Google / Facebook Authentication Types you can interact with Google API from the application which has integrated security enabled (GeneXus Access Manager).


The following is an example where we get the Google RSS feeds where the user has a subscription.

1. Define GAM Google Authentication Type (X Evolution 3 upgrade 3 and prior).


Specify Additional Scope = as seen in the figure above.

The code used for setting the Additional scope for Google Authentication is the following.

&AuthenticationTypeGoogle.Google.AdditionalScope= &AdditionalScope

Note that AuthenticationTypeGoogle is a variable based on GAMAuthenticationTypeGoogle external object. See the figure below for details on this data type.


2. Next we show the sample code to interact with the Google API and get the RSS feeds of the user in the GAM session.

First we get the current GAMSession and we get the ExternalToken of it by means of the ExternalToken GAMSession property.
Afterwards we can define a variable based on HTTPClient data type in order to execute a method of the Google API which receives the ExternalToken obtained previously.

//Get the current GAMSession
&GamSession = GAMSession.Get(&GamErrorCollection) //&GamErrorCollection is a collection of GAMError data type

//Get the ExternalToken provided by Google after the authentication has been successful
&ExternalToken = &GamSession.ExternalToken.Trim()

&httpClient.Host = "" //&httpClient is HTTPClient data type
&httpClient.BaseUrl = "reader/api/0/subscription/"
&httpClient.Execute("GET", "list?output=json&access_token=" + &ExternalToken)

if (&httpClient.ErrCode<>0)
  msg(format("HttpClientError %1 %2", &httpClient.ErrCode, &httpClient.ErrDescription))
  &result = &httpClient.ToString()
  &subscriptions = &subscriptionlist.subscriptions

&subscriptions and &subscriptionlist are variables placed on the form were we load the HTTPResponse sent from the Google Api called.



  • The Additional Scope can be any string, and you can specify more than one separated by "+".
  • The first time the users logs to the application, he is shown a message where he is asked to confirm to access the Google Reader resources.
  • There are other available scopes, here.

See Also

Interact with Facebook APIs using GAM