GAM Facebook Authentication TypeOfficial Content

GeneXus Access Manager provides a way to authenticate using Facebook. 

Steps to follow

1. Create a "Facebook client application"

Create a "Facebook client application" in Facebook site and obtain App Id and App Secret for that application.

Go to Facebook for developers ( -> My apps -> Add a new app, as shown in the following figures:




Enter the Site URL = http://<domain> (eg.:


Go through settings > Basic, to get the App Id and App Secret of the application


Go through Products > Facebook Login > Settings. There enter a valid value for "Valid OAuth redirect URIs" field.

A valid format is : http://<server>/<base url>/oauth/gam/callback

You can enter as many URIs as you want in that field.

Note also that "Web Oauth Login" must always be set to TRUE.


Note: Remember to make the FB application public

2. Define "Facebook Authentication Type"

Define "Facebook Authentication Type" using the GAM backend. Go through Authentication Types link.


Facebook API needs the SITE URL to be different than "localhost" and the default port needs to be 80. If your application is hosted under port 8080, you need to use a proxy or similar (like Apache web server) in order to use port 80.

Important note:

The Local Site URL specified is only the domain where the application runs. You don't need to enter the complete site URL.

For example

If you enter the complete Site URL is also right, but never include the "/servlet" in Java.

Facebook Authentication Type can be used in Web Applications and Smart Devices applications also.

Web Applications

In the 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 Facebook.
This button is included dynamically, as the Facebook Authentication Type is already defined in the GAM Repository.

The code associated with that button, which authenticates to Facebook, is as follows:

Event &ButtonFacebook.Click


Considerations: The LoginFacebook function doesn't work as expected in popup windows (the same happens to LoginTwitter). This is a limitation of those sites, who don't support a redirect from an HTML iframe. For a workaround, see SAC 34259

Smart Devices Applications

In the case of Smart Devices applications, you need to add an event in the login object to authenticate using Facebook.

The logic inside the event associated will include a call to a method of Actions external object, named "LoginExternal".

The first parameter this method receives has to take its value from the Type name defined in the "Authentication Type" definition of the GAM Repository ("Facebook").

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


iOS 6.0 Facebook Integration
Windows Phone Facebook Integration

Software Requirements

  •     Java: JDK 1.7 or upper is required to be installed on the application server. Otherwise, the Facebook certificate has to be installed in the key store of the JVM.
  •     Csharp: The certificate of Facebook has to be installed on the windows server.


1. Facebook Authentication is solved using OAuth.

2. In case you want to "work with friends", or do any particular action after the user has logged in, you need to communicate with the Facebook API. In that case, you'll probably need to get the ExternalToken method of GAMSession EO. The result of invoking this method should be passed to the Facebook API.

See Also

GAM: Facebook Interaction Sample
GAM Twitter Authentication Type
GAM Google Authentication Type
Additional Scope Property for GAM Google / Facebook Authentication Types

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