Table of contents

Official Content

To authenticate to Twitter using GAM, follow the steps below:


Step 1. Create a Twitter application.

You need to create a "Twitter application" on the Twitter website and get a 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.:

Figure 2. Configuring Twitter Application: Keys and Access Tokens

From here you will obtain a "Consumer Key" and "Consumer Secret".

Step 2. Define Twitter authentication type

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

Enter the Consumer Key and Consumer Secret obtained on Twitter's developer website.

Twitter authentication type - gam - v18

Figure 3. Configuring Twitter Authentication in GAM backend.

Important note

About the CallBack URL configuration in GAM Backend: you only need to enter the domain of the server running the application.
It isn't necessary to enter the complete website URL. However, if you enter it, do not include the "/servlet" in Java.

*This authentication type it's not allowed in Angular Generator.

Twitter Login

Twitter authentication type can be used in Web Applications and in Native Mobile applications.

Web Applications

See the GAMExampleLogin object for details about how 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 associated event will include a call to a method of the 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 parameter has an "AuthenticationTypeName" property where you can set the name of the Authentication Type. This is because 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)

Below is another way to program the Twitter login when you only have one Twitter authentication type in the repository (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 is necessary to configure the Twitter Consumer Key and Twitter Consumer Secret properties. See Twitter Consumer Key and Twitter Consumer Secret property using GAM for additional information.


1. The Twitter API needs the SITE URL to be public and without any port; therefore, 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 users log in to Twitter, they will probably need to complete a form where they have to enter their email.
3. Important: If you don't set a callback URL = http://<domain>/oauth/gam/callback you may get the following errors:





See Also

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


Last update: November 2023 | © GeneXus. All rights reserved. GeneXus Powered by Globant