Package: react-wallet-kit

Defined in: react-wallet-kit/src/providers/client/Types.tsx:247

Overview

Handles the Apple OAuth flow.
  • This function initiates the Apple OAuth flow by either redirecting the user to the Apple authorization page or opening it in a popup window.
  • The flow type is determined by the openInPage parameter: if true, the current page is redirected; if false (default), a popup window is used.
  • 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.
  • Constructs the Apple OAuth URL with all required parameters, including client ID, redirect URI, response type, response mode, nonce, and state.
  • The state parameter includes the provider, flow type, public key, and any additional state parameters for tracking or custom logic.
  • If openInPage is true, the function redirects and returns a promise that resolves on redirect or times out after 5 minutes.
  • If openInPage is false, a popup window is opened and the function returns a promise that resolves when the flow completes, or rejects if the window 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, popup failures, and timeouts, and throws a TurnkeyError with appropriate error codes.

Parameters

params
object

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.