Skip to main content

Package: react-native-wallet-kit

Defined in: react-native-wallet-kit/src/providers/Types.tsx:334

Overview

Handles the Facebook OAuth flow.
  • This function initiates the Facebook OAuth flow by opening the in-app browser and deep-linking back to the app.
  • On React Native, the flow always uses the in-app browser.
  • Generates a new ephemeral API key pair and uses its public key as the nonce for the OAuth request, ensuring cryptographic binding of the session.
  • Uses PKCE (Proof Key for Code Exchange) for enhanced security, generating a code verifier and challenge for the Facebook OAuth flow.
  • Constructs the Facebook OAuth URL with all required parameters, including client ID, redirect URI, response type, code challenge, nonce, and state.
  • The state parameter includes the provider, flow type, public key, and any additional state parameters for tracking or custom logic.
  • The flow resolves when the app is deep-linked back; it rejects if the in-app browser is closed or times out.
  • On successful authentication, the function either calls the provided onOauthSuccess callback, triggers the onOauthRedirect callback from provider callbacks, or completes the OAuth flow internally by calling completeOauth.
  • Handles all error cases, including missing configuration, in-app browser failures, and timeouts, and throws a TurnkeyError with appropriate error codes.

Parameters

params
HandleFacebookOauthParams

Response

A successful response returns the following fields:
returns
void
required
A promise that resolves when the OAuth flow is successfully initiated and completed, or rejects on error or timeout.