Developer Console

A3L Authentication Sample App

This page walks you through a sample app built using the A3L Authentication SDK. The purpose of the app is to demonstrate how to integrate with A3L Authentication. To run this app, you don't need to write any code, but you must provide the configurations. You can install the app on both Google Play-enabled devices and Fire OS devices. You will be able to sign in to a Google account through the app and fetch the profile details. The app also implements sign out and revoke access functionalities.

Download sample app project

The A3L Authentication SDK download includes a sample app project in Java and Kotlin. You can download the SDK from SDK Downloads. The file contains an Android project which you can use to configure and build the sample app.

When building the project, if you run into an "SDK location not found" error, add a line in the local.properties file at the root of the project to include your Android SDK location.

For example:

  • On Windows, add the line: sdk.dir=C:\\Users\\<username>\\AppData\\Local\\Android\\sdk
  • On Mac, add the line: sdk.dir=/Users/<username>/Library/Android/sdk

Replace <username> with your username.

Configure sample app

To configure the sample app, follow these steps.

  1. Obtain the Android client ID and optionally the OAuth 2.0 client ID that are provided by the Google API Console. For details on how to fetch the IDs, see Configure Google API Console.

  2. Open the app/src/res/values/strings.xml file and update the placeholder values for app_client_id and server_client_id.

     <string name="app_client_id">PREFIX</string>
     <string name="server_client_id">SERVER_CLIENT_ID</string>
    

    Replace PREFIX with the Android client ID prefix (the text before .apps.googleusercontent.com) and replace SERVER_CLIENT_ID with the OAuth2.0 client ID.

  3. Open the app's build.gradle file. Update the placeholder value for appAuthRedirectScheme.

     defaultConfig {
             -----------------
             manifestPlaceholders = [
                     'appAuthRedirectScheme': 'com.googleusercontent.apps.<PREFIX>'
             ]
             ------------------
         }
    

    Replace <PREFIX> with the Android client ID prefix (the text before .apps.googleusercontent.com).

Test sample app

Use these steps to test the sample app.

  1. After completing the configuration steps in the preceding section, build the app.
  2. Install the app on an Android device that has Google Play services enabled, or on a Fire OS device.
  3. Launch the app. The app displays the text A3L Auth and has a Sign in with Google button.
  4. Click Sign in with Google. The app redirects you to the sign-in flow, which depends on the device where the app was installed.
  5. After signing in, the app displays your profile details and two buttons, Revoke Access and Sign Out. Click the buttons to verify their functionality.

Last updated: May 19, 2023