ForgeRock SDKs

Configure the Android SDK

To configure the ForgeRock Android SDK, you add properties to the project’s resource files.

The properties configure how the SDK connects to the ForgeRock Identity Platform, and which OAuth 2.0 client profile to use.

The available configuration properties are as follows:

Property Description


The client_id of the OAuth 2.0 client profile to use.


The redirect_uri as configured in the OAuth 2.0 client profile.


A list of scopes to request when performing an OAuth 2.0 authorization flow.


A threshold, in seconds, to refresh an OAuth 2.0 token before the access_token expires (defaults to 30 seconds).


The base URL of the AM instance to connect to, including port and deployment path. For example,


The realm in which the OAuth 2.0 client profile is configured. The default is the top-level realm; root).


A timeout, in seconds, for each request that communicates with AM.


The name of the account provider displayed by Android when using single sign-on. For example "ForgeRock Tutorial App".


The name of the user account displayed by Android when using single sign-on. For example "Demo User".


The name of the user authentication tree configured in AM.


The name of the cookie that contains the SSO token. For example iPlanetDirectoryPro.

To locate the cookie name in a ForgeRock Identity Cloud instance, go to Tenant Settings > Global Settings > Server.

Configure the ForgeRock Android SDK

  1. In the Project tree view of your Android Studio project, navigate to app > src > main > res > values, and then open the strings.xml file.

  2. Inside the <resources> element, add the following elements, adjusting the values for your deployment:

    <!-- OAuth 2.0 client details -->
    <string name="forgerock_oauth_client_id" translatable="false">ForgeRockSDKClient</string>
    <string name="forgerock_oauth_redirect_uri" translatable="false"></string>
    <string name="forgerock_oauth_scope" translatable="false">openid profile email address phone</string>
    <integer name="forgerock_oauth_threshold" translatable="false">30</integer>
    <!-- AM instance details -->
    <string name="forgerock_url" translatable="false"></string>
    <string name="forgerock_cookie_name" translatable="false">iPlanetDirectoryPro</string>
    <string name="forgerock_realm" translatable="false">root</string>
    <integer name="forgerock_timeout" translatable="false">30</integer>
    <!-- Single sign-On details -->
    <string name="forgerock">ForgeRock SDK Tutorial</string>
    <string name="forgerock_account_name" translatable="false">Demo User</string>
    <!-- AM tree details -->
    <string name="forgerock_auth_service" translatable="false">sdkAuthenticationTree</string>
Copyright © 2010-2022 ForgeRock, all rights reserved.