GAM - Twitter Authentication Type

Official Content
This documentation is valid for:

In order to authenticate to Twitter, through GAM just follow these steps.


Step 1. Create a Twitter application

You need to create a "Twitter application" in Twitter site and obtain Consumer Key and Consumer Secret for that application.

Go to the Application Management page of Twitter for developers ( and create a new application, considering the following settings:

Figure 1. Configuring Twitter Application: Settings

Important: Set Callback URL = http://<domain>/oauth/gam/callback

and WEB SITE to your domain (eg.:

Twitter Configuration
Figure 2. Configuring Twitter Application: Keys and Access Tokens


Step 2. Define Twitter Authentication Type

Define "Twitter Authentication Type" using the GAM backend (Authentication Types link).

Enter Consumer Key and Consumer Secret obtained in Twitter developer's site.

Twitter authentication type - gam - v18

Figure 3. Configuring Twitter Authentication in GAM backend.

Important note

About the CallBack URL configuration in GAM Backend. You just need to enter the domain of the server running the application.
It isn't necessary to enter the complete site URL, but in case you enter it, do not include the "/servlet" in java.

Twitter Login

Twitter Authentication Type can be used in Web Applications and in Native Mobile applications also.

Web Applications

See the GAMExampleLogin object for details about how the login is executed.

Native Mobile Applications

In the case of Native Mobile applications, you need to add an event in the login object to authenticate using Twitter.
The logic inside the event associated will include a call to a method of Actions external object, named "LoginExternal".

The first parameter is based on the GAMAuthenticationTypes domain, and its value should be "Twitter".
The &User and &password parameters are ignored in this case.
The &LoginExternalAdditionalParameters has an "AuthenticationTypeName" property where you can set the name of the Authentication Type. This is due to the fact that more than one Twitter Authentication Type can be defined in the Repository.

Event 'Twitter'
        &LoginExternalAdditionalParameters.AuthenticationTypeName    = !"Twitterb"  
      GeneXus.SD.Actions.LoginExternal(GAMAuthenticationTypes.Twitter, &User, &Password, &LoginExternalAdditionalParameters)

Another way to program the Twitter login, when you only have one Twitter Authentication Type in the repository, is the following (without passing the &LoginExternalAdditionalParameters):

Event 'Twitter'
        GeneXus.SD.Actions.LoginExternal(GAMAuthenticationTypes.Twitter, &User, &Password)

See GAM Login Method for details.

Important considerations for Apple apps

It's necessary to configure Twitter consumer Key and Twitter consumer secret properties. See Twitter Consumer Key and Twitter Consumer Secret property using GAM for additional information.


1. Twitter API needs the SITE URL to be public and without any port, so if your application is hosted under port 8080 for example, you need to use any kind of proxy or similar (like Apache web server) in order to use port 80. For more details see the additional information at the bottom of this page. 
2. The first time a user logs in to Twitter he will probably need to complete a form where he has to enter his e-mail.

See Also

Twitter Consumer Key and Twitter Consumer Secret property using GAM
Facebook Authentication Type
Google Authentication Type