GAM Twitter Authentication Type

Official Content

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

Step 1.

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, as shown in the following figure:

Figure 1. Creating a new Application in Twitter
Twitter App Settings
Figure 2. Configuring Twitter Application: Settings
Twitter Configuration
Figure 3. Configuring Twitter Application: Keys and Access Tokens

Set Callback URL = http://<domain>/ and WEB SITE to your domain (eg.:

Step 2.

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

Enter Consumer Key and Consumer Secret obtained in Twitter developers site.


Figure 4. 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 Authentication Type can be used in Web Applications and in Smart Devices applications also.

Web Applications

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

Figure 5. GAM Web login.

SD Applications

In case of Smart Devices applications, you need to change the "Login Object for SD" (it is at the Version level and has the "GAMSDLogin" default value) and add a button which will be specifically for this type of authentication. 

Inside the event the code associated to this button will include a call to a method of SDActions, named "LoginExternal".

The first parameter that this method receives, takes its value from the Type name defined in the "Authentication Type" definition of the GAM Repository ("Twitter") - see Figure 4.

Event 'Twitter'

There's no need to define variables for the parameters, because in this case the only important parameter of "LoginExternal" Method, is the first parameter whose value is always "Twitter".

As happens in web applications, when clicking the "Twitter" button, the Twitter login appears in the device and after you have logged in, the application will load.

What happens really is that after the user authenticates in Twitter, the application redirects to "GAM application" where the user is created using the credentials given to Twitter, and it generates a Session in GAM. User's data is updated taking the information from Twitter in each new login.

After a user has logged in using Twitter, his information can be seen looking at the "Users" information using the GAM Backend.

Figure 6. Work with users in GAM backend.

Important considerations for IOS 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
GAM Facebook Authentication Type
GAM Google Authentication Type

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.