---
title: OpenID Connect Authentication
description: >-
  OpenID Connect sign-in: obtaining ID tokens with react-native-app-auth and
  exchanging them via OAuthProvider and signInWithCredential.
next: /auth/multi-factor-auth
previous: /auth/email-link-auth
---
> ## Documentation Index
> Fetch the complete documentation index at: https://rnfirebase.io/llms.txt
> Use this file to discover all available pages before exploring further.

## Prerequisites

- `@react-native-firebase/app` and `@react-native-firebase/auth` installed and native config completed per [Authentication usage](/auth/usage) / [Getting Started](/). From v26, New Architecture is required for packages with a native bridge.
- An OpenID Connect provider configured in your identity system (issuer URL, client ID, redirect URL, scopes).
- The same provider added under Firebase Console → Authentication → Sign-in method → **OpenID Connect** (Custom providers). Note the Provider ID shown as `oidc.<name>` (for example `oidc.azure_test` when the Name field is `azure_test`).
- [`react-native-app-auth`](https://github.com/FormidableLabs/react-native-app-auth) installed and its native redirect URL setup completed (or another OpenID Connect client that returns an ID token).

Example Expo Router screen: https://github.com/invertase/react-native-firebase/blob/main/test-expo/app/auth/social.tsx (connects to the Auth emulator; its OpenID Connect controls exchange a token with `OAuthProvider`).

React Native Firebase supports integrating with OpenID Connect providers. Obtaining the ID token is left to your app because provider flows differ. Use `OAuthProvider('oidc.<suffix>')` with `signInWithCredential()`, matching the [Firebase web OpenID Connect guide](https://firebase.google.com/docs/auth/web/openid-connect).

Also handle provider logout / token revocation for your provider when the user signs out of Firebase, if your product requires it.

# Getting started

1. Setup or get the configuration from the provider you want to use.
2. Add the provider in the Firebase console.
3. Authenticate in the app using `react-native-app-auth` (or equivalent) and `@react-native-firebase/auth`.

## 1. Setup or get the configuration from the provider you want to use

Follow your provider's documentation until you have a working OpenID Connect client (issuer, client ID, redirect URL, scopes). Examples of tested OpenID providers for `react-native-app-auth` are listed in [that project's documentation](https://github.com/FormidableLabs/react-native-app-auth#tested-openid-providers).

## 2. Add the provider in the Firebase console

If the provider is not added in the Firebase project, `signInWithCredential` will reject the credential.

1. Open the Firebase console for your project.
2. Authentication → Sign-in method.
3. If you already have providers, click **Add new provider**.
4. Under **Custom providers**, choose **OpenID Connect**.
5. Enable OpenID Connect.
6. Fill in **Name**, **Client ID**, **Issuer (URL)**, and **Client secret** to match your OpenID Connect provider.
7. Note the **Provider ID** under the Name field. If Name is `azure_test`, Firebase shows `Provider ID: oidc.azure_test`. Pass the full `oidc.azure_test` ID to `OAuthProvider`.

## 3. Authenticate in the app

Complete [`react-native-app-auth` getting started](https://github.com/FormidableLabs/react-native-app-auth#getting-started) before running the end-to-end snippet.

Credential exchange (matches firebase-js-sdk):

```js
import { OAuthProvider, getAuth, signInWithCredential } from '@react-native-firebase/auth';

async function signInWithOidcIdToken(providerId, idToken) {
  // providerId is the full Firebase Provider ID, e.g. 'oidc.azure_test'.
  const provider = new OAuthProvider(providerId);
  const credential = provider.credential({ idToken });
  return signInWithCredential(getAuth(), credential);
}

await signInWithOidcIdToken('oidc.azure_test', 'PROVIDER_ID_TOKEN');
```

End-to-end example with `react-native-app-auth` (install that package in your app):

```js
// codeblock-ignore: react-native-app-auth is a third-party package; install it in your app
import { OAuthProvider, getAuth, signInWithCredential } from '@react-native-firebase/auth';
import { authorize } from 'react-native-app-auth';

const config = {
  issuer: 'https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0',
  clientId: 'YOUR_CLIENT_ID',
  redirectUrl: 'msauth.your.bundle.id://auth/',
  scopes: ['openid', 'profile', 'email', 'offline_access'],
  useNonce: false,
};

async function signInWithOidcViaAppAuth() {
  const authState = await authorize(config);
  const provider = new OAuthProvider('oidc.azure_test');
  const credential = provider.credential({ idToken: authState.idToken });
  return signInWithCredential(getAuth(), credential);
}

await signInWithOidcViaAppAuth();
```

Upon successful sign-in, any [`onAuthStateChanged`](/auth/usage#listening-to-authentication-state) listeners receive the signed-in user.
