Skip to main content

Use the API from React Native

The @thefaithapp/auth-react-native package signs a member in through TheFaithApp and sends authenticated v1 API requests from React Native and Expo apps. Your app does not need to host a callback website.

Before you begin

You need:
  • an Expo SDK 57 app targeting iOS or Android
  • its Android application ID and iOS bundle ID
  • a client API key from Settings > Developer Access
1

Add the package

Install the SDK and its Expo modules:
2

Add the config plugin

Add the SDK plugin and your application identifiers to app.json:
The plugin adds the mobile callback to both native projects when you build the app.
3

Register your React Native app

In the TheFaithApp dashboard:
  1. Open Settings > Developer Access.
  2. Click Add React Native app.
  3. Append .thefaithapp to your application ID.
  4. Add the app and copy your client API key.
For an application ID of com.example.app, enter:
The dashboard creates the callback expected by the package:
If iOS and Android use different identifiers, register both callbacks. Avoid underscores because they cannot be used in a callback URI scheme.
4

Create a native build

Rebuild the app so the native callback configuration is included:
Use a development build or standalone app for this flow. Expo Go cannot be rebuilt with your application’s callback scheme.
5

Initialize the SDK

Provide the client key when creating TheFaithAppAuth:
Supply the value from your development or build environment instead of committing it to source control.
6

Sign in a member

Start sign-in from a button or another user action:
The package returns to the app after hosted sign-in and stores the member session securely.
7

Call a v1 endpoint

Use authorizedFetch for protected API requests:
Pass another relative /v1/... path to call endpoints from the API Reference.

Restore the saved session

Check for a saved session when the app starts:

Access the bearer token

When an integration needs the token directly:
Do not log the token or include it in analytics and crash reports.

Sign out

Revoke the member session and remove its saved copy:

Handle SDK errors

Troubleshooting

Next steps

  • Browse the endpoint groups in the API Reference navigation.
  • Read Pagination and Errors before loading lists or adding retry behavior.
  • Use the public standalone sample as a compact reference implementation.