Tutorial
This tutorial guides you through creating a ForgeRock SDK-enabled Android app from beginning to end.
It uses embedded login to implement user authentication journeys, meaning you get to design and implement the user interface to your requirements.
Source code for the quick start application is available in the ForgeRock SDK for Android GitHub repo. |
Prerequisites
You need to set up your ForgeRock Identity Cloud or AM instance with an OAuth 2.0 client, authentication journey, and a demo user:
- Configure ForgeRock Identity Cloud
- Configure a self-managed AM server
Steps
- Step 1. Configure the development environment
-
In this step, you set up your environment to create Android applications using the freely-available Android Studio IDE.
You then create a new application project and configure it to use the ForgeRock SDK for Android.
- Step 2. Configure connection strings
-
In this step, you provide your application with the settings it needs to connect to your ForgeRock Identity Cloud or AM instance.
For example, which authentication tree to use, and the realm it is a part of.
- Step 3. Initialize the SDK
-
In this step, you enable debug logging during development.
You then and add a call to the
FRAuth.start()
method, which initializes the SDK and loads the configuration you have defined in the previous step. - Step 4. Create a status view
-
In this step, you create a layout and add buttons to log in and log out your user, as well as a text view field to show their current authentication status.
You also add the code to update the value displayed in the text view.
- Step 5. Add login and logout calls
-
In this step, you update the app with the
NodeListener
interface, which manages the client side of the authentication journey. - Step 6. Create UI to handle the callbacks
-
In this step, you add a UI fragment to obtain credentials from the user, and code to open that fragment when the callback is received.
You also add code to populate the callback with the credentials and return it to the server, completing the authentication journey.
- Step 7. Test the app
-
In this step, you will test your application.
You run it in the emulator or on your Android device, perform authentication with a demo user, check the log for success messages, and then log out the user.