Friday, May 27, 2016

ForgeRock OpenAM 13 and Social Login Part 2: Google

How to easily configure Google with OpenAM 13

This is a quick guide to setting up Google as a social authentication module for OpenAM 13. Prerequisites are a working OpenAM13 environments and a google developer account. This will be needed to obtain a client ID and client secret that you will need to use when you configure the authentication module.

Obtaining a Google App ID and App Secret
Go to Login with your google account. On the left frame, under API Manager, click on the Credentials link.

On the APIs Credentials box, click on the ‘Create credentials’ and select 'OAuth client ID’.

Select ‘Web Application’ as the Application type. Give it a name and add the openam service URL under the Authorized Javascript origins. It is also important you add the Authorized redirect URIs for OpenAM. This is http://host:port/openam/oauth2c/OAuthProxy.jsp.

If this is the first application profile you create, you will be prompted to fill in some information related to the consent screen which users will see when they are asked to authenticate using their google account.

Once the profile is complete and you click on save you will receive a pop up with the client ID and secret.

Here you will copy the Client ID as well as the Client Secret. You will need both of these when configuring Google Authentication Module on OpenAM.

Configuring OpenAM 13

Now login to the OpenAM admin console at http://host:port/openam/console
Select the realm you intend on setting up social authentication module on.

Click on Configure Social Authentication:

Click on Configure Google Authentication

Enter the Client ID and Client Secret and click Create to continue. The Redirect URL is automatically populated.

Once created you will get a success message.

Expanding on the Authentication section and clicking on Modules will show a new ‘GoogleSocialAuthentication’. In addition a new chain is also created using this new module named 'GoogleSocialAuthenticationService’.

Click on the module to look at some of the default settings.

Note in particular two settings:

With these two settings, users who successfully authenticate against Google will have a profile dynamically created in your data store. Your Google users will be pre-fixed with identifier “google-“ as shown in the attribute mapper. You can modify that here if you wish to remove or change that.

Testing Google Authentication

Simplest way to validate the Google authentication chain is to update the Authentication settings and make the chain the default Organization Configuration Chain.

Test the authentication by going to http://host:port/openam. This should automatically redirect you to the Google authentication.

Google’s consent screen will appear.

Once you allow and successfully authenticate with Google, you will be redirected back to OpenAM, have your profile dynamically created, and logged into the console where you will see your profile.

Logged in as OpenAM admin user, search under subjects for the new Google created ID, you will see which attributes were shared from Google.

And that competes the setup for the Google Authentication module for use by OpenAM 13. As with any module you don’t need to set it up as the default Authentication chain used by the realm. It can appear as an icon on the login page or you can invoke the authentication chain via REST for complete UI control.

Using REST APIs via postman client



  1. This comment has been removed by the author.

  2. I read your blog frequently, and I just thought I’d say keep up the fantastic work! It is one of the most outstanding blogs in my opinion. pizza logo design

  3. Your logo should put over an unmistakable message to potential clients about your business, items and administrations and in doing as such guide their basic leadership with regards to acquiring from you. logo design service

  4. Thank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our. smm panels list