ForgeRock SDKs 3.3

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

forgerock_oauth_client_id

The client_id of the OAuth 2.0 client profile to use.

forgerock_oauth_redirect_uri

The redirect_uri as configured in the OAuth 2.0 client profile.

forgerock_oauth_scope

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

forgerock_oauth_threshold

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

forgerock_url

The base URL of the AM instance to connect to, including port and deployment path. For example, https://openam.example.com:8443/openam.

forgerock_realm

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

forgerock_timeout

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

forgerock

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

forgerock_account_name

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

forgerock_auth_service

The name of the user authentication tree configured in AM.

forgerock_cookie_name

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">https://sdkapp.example.com:8443/callback</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">https://openam.example.com:8443/openam</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.