---
title: Step 4. Running and testing the app
description: Run the PingSampleApp on Android or iOS and authenticate through a PingOne DaVinci flow.
component: orchsdks
page_id: orchsdks:davinci:try-it-out/react-native/04_run_the_sample
canonical_url: https://developer.pingidentity.com/orchsdks/davinci/try-it-out/react-native/04_run_the_sample.html
llms_txt: https://developer.pingidentity.com/orchsdks/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
keywords: ["PingOne", "DaVinci", "Setup &amp; Configuration", "Source Code", "Tutorial", "SDK", "React Native"]
section_ids:
  starting_the_metro_bundler: Starting the Metro bundler
  running_on_android: Running on Android
  running_on_ios: Running on iOS
  authenticating_with_a_davinci_flow: Authenticating with a DaVinci flow
  viewing_session_and_token_information: Viewing session and token information
  signing_out: Signing out
  troubleshooting: Troubleshooting
  what_can_cause_a_redirect_uri_error: What can cause a redirect URI error?
  what_can_cause_an_android_sdk_location_error: What can cause an Android SDK location error?
  what_can_cause_an_ios_build_error: What can cause an iOS build error?
---

# Step 4. Running and testing the app

[icon: circle-check, set=far]PingOne [icon: react, set=fab]React Native

* [Prepare](00_before-you-begin.html)

* [Download](01_download_samples.html)

* [Install](02_prepare-projects.html)

* [Configure](03_configure_sample.html)

* **Run**

In the following procedure, you run the `PingSampleApp` project configured in the previous steps.

Unless otherwise specified, run the commands from the `PingSampleApp` directory.

## Starting the Metro bundler

Metro is the JavaScript bundler for React Native.

Start it in a terminal window and leave it running:

```shell
yarn start
```

## Running on Android

In a separate terminal window, from the `PingSampleApp` directory, run the sample app on an Android emulator or connected device:

```shell
yarn android
```

## Running on iOS

In a separate terminal window, from the `PingSampleApp` directory, run the sample app on the iOS simulator:

```shell
yarn ios
```

## Authenticating with a DaVinci flow

After launching the app, follow these steps to run an authentication flow:

1. On the home screen, tap **[icon: vpn_key, set=material, size=inline] DaVinci flow**.

   The app starts the DaVinci flow and renders the fields and actions returned as collectors:

   ![Android screenshot showing the DaVinci flow login screen](../../_images/samples/react_native/react_native_android_login.png)Figure 1. The DaVinci flow login screen

2. Enter the credentials or other values requested by the flow, and submit each step.

   The exact screens depend on the connectors and fields configured in your PingOne flow.

3. After successful authentication, the app displays the authenticated state:

   ![Android screenshot showing the authenticated state in the sample app](../../_images/samples/react_native/react_native_android_authenticated.png)Figure 2. The authenticated state in the Android sample app

4. Tap **User Profile**, and then select the **DaVinci** tab to view profile information gathered from the `/userinfo` endpoint:

   ![Android screenshot showing the DaVinci user profile screen](../../_images/samples/react_native/react_native_android_userinfo.png)Figure 3. The DaVinci user profile screen

5. Tap the back arrow ([icon: arrow_back, set=material, size=inline]) to return to the main menu, tap **[icon: token, set=material, size=inline] Access Token**, and then select the **DaVinci** tab.

   The sample app displays the issued access token, and provides buttons to refresh or revoke the token:

   ![Android screenshot showing the DaVinci access token screen](../../_images/samples/react_native/react_native_android_token.png)Figure 4. The DaVinci access token screen

6. Tap the back arrow ([icon: arrow_back, set=material, size=inline]) to return to the main menu, tap **[icon: logout, set=material, size=inline] Logout**, and then tap **Logout from DaVinci Session**:

   ![Android screenshot showing the DaVinci logout screen](../../_images/samples/react_native/react_native_android_sign_out.png)Figure 5. The DaVinci logout screen

   The app signs out the active user.

## Viewing session and token information

Use the sample app's token screen to view the session information returned after authentication, including the access token and any refresh token issued by PingOne.

Use the user information screen to request claims from the OIDC user information endpoint when supported by the configured flow and session.

## Signing out

Use the sample app's logout action to sign the user out and clear the active DaVinci session.

If you need to revoke the access and refresh tokens explicitly, use the `revoke()` operation before signing out, as described in [Managing sessions and tokens in React Native](../../usage/react-native/06-handling-sessions.html).

## Troubleshooting

This section contains help if you encounter an issue running the sample app.

### What can cause a redirect URI error?

If the authentication request fails with a redirect URI error, ensure that `PINGONE_REDIRECT_URI` exactly matches a redirect URI registered in your PingOne OAuth 2.0 application.

Also ensure that the redirect scheme matches the Android `appRedirectUriScheme` value and the iOS `CFBundleURLSchemes` value.

### What can cause an Android SDK location error?

If Android cannot find the SDK, set `ANDROID_HOME` or create `PingSampleApp/android/local.properties` with the Android SDK path:

```properties
sdk.dir=/path/to/your/Android/SDK
```

### What can cause an iOS build error?

If the iOS build fails after native dependencies change, reinstall the CocoaPods dependencies:

```shell
bundle exec pod install --project-directory=ios
```

If Metro behaves unexpectedly after changing configuration, reset its cache:

```shell
yarn start --reset-cache
```

If Android Studio cannot find Node, launch it from a terminal where Node is on your `PATH`:

```shell
open -a "Android Studio"
```
