Skip to content

Latest commit

 

History

History

README.md

Ping Identity Logo


OIDC app using React Native

Ping provides these React Native samples to help demonstrate SDK functionality/implementation. They are provided "as is" and are not official products of Ping and are not officially supported.

This repository contains an example React Native project demonstrating OIDC (redirect) authentication using the Ping Orchestration SDK for React Native. Can be used with PingOne Advanced Identity Cloud, PingOne and PingAM.

Requirements

  • Node.js >= 18
  • React Native CLI environment set up for iOS and Android
  • Xcode: Latest version recommended (iOS 16+)
  • Android Studio: Latest version recommended with Java 17 (Android API level 29+)
  • Ruby >= 3.3.6 + Bundler (iOS only)
  • Ping AIC, PingAM or PingOne server

Getting Started

  1. Configure Ping Services: Register an OAuth 2.0 / OIDC application for native mobile apps. Refer to the official Server Configuration Guide for more details.

  2. Clone the repository:

    git clone https://github.com/ForgeRock/sdk-sample-apps.git
    cd sdk-sample-apps/reactnative/reactnative-oidc
  3. Configure the app: Copy the example env file and fill in your server details.

    cp .env.example .env

    Locate the TODO comment in .env.example and replace the placeholder values in .env with your configuration.

  4. Redirect URI: the app's redirect URI scheme is pre-wired to org.forgerock.oidc://oauth2redirect. If you pick a different scheme, update the redirect URI values in .env, manifestPlaceholders["appRedirectUriScheme"] in android/app/build.gradle, and the oauth2redirect entry of CFBundleURLTypes in ios/PingSampleApp/Info.plist.

  5. Install dependencies:

    yarn install
  6. iOS only — install CocoaPods:

    cd ios
    bundle install
    bundle exec pod install
    cd ..
  7. Android only — keystore setup: android/app/build.gradle signs the debug build with android/app/debug.keystore using the alias androiddebugkey, and reads the keystore/key passwords from Gradle properties named KEYSTORE_PASSWORD and KEY_PASSWORD, which aren't set anywhere in this repo. Generate your own debug keystore with that filename and alias:

    keytool -genkeypair -v \
      -keystore android/app/debug.keystore \
      -alias androiddebugkey \
      -keyalg RSA -keysize 2048 -validity 10000 \
      -storepass <your-password> -keypass <your-password> \
      -dname "CN=Android Debug,O=Android,C=US"

    Then add your credentials to your global ~/.gradle/gradle.properties (create the file if it doesn't exist):

    KEYSTORE_PASSWORD=<your-password>
    KEY_PASSWORD=<your-password>

    Skipping this step causes the build to fail signing, which then fails app installation.

  8. Run the app:

    yarn ios
    # or
    yarn android

Additional Resources

License

This software may be modified and distributed under the terms of the MIT license. See the LICENSE file for details.

© Copyright 2024-2026 Ping Identity Corporation. All rights reserved.