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
stateparameter 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
onOauthSuccesscallback, triggers theonOauthRedirectcallback from provider callbacks, or completes the OAuth flow internally by callingcompleteOauth. - Handles all error cases, including missing configuration, in-app browser failures, and timeouts, and throws a
TurnkeyErrorwith appropriate error codes.
Parameters
Response
A successful response returns the following fields:A promise that resolves when the OAuth flow is successfully initiated and completed, or rejects on error or timeout.