Skip to main content
<MoonPayAuth> renders the MoonPay auth frame inline in your layout. It is the declarative alternative to client.setupAuth(). The auth frame is a lighter-weight counterpart to the connect flow. It drives the customer through email/OTP authentication only, without the full connect UI. This makes it a good fit for headless and Customer API integrations. Precondition: a clientToken must be present in the client context before mounting this component. The token is populated automatically when client.getConnection() or <MoonPayConnectionCheck> resolves with status: "connectionRequired". If no token is present, the component emits an "error" event. When the customer completes the flow with an active or pending connection, credentials are decrypted and stored on the shared client automatically.
AuthScreen.tsx

Props

AuthEvent

Use event.kind to handle each event. ConnectionError is discriminated by code: ConfigValidationFieldError entries have code: "invalidSessionToken" | "invalidClientToken" | "invalidPublicKey" and a developer-facing message.
Check event.payload.status before you treat "complete" as a successful sign-in. An unavailable connection carries no credentials and can’t be used: show your own message or offer another payment option instead of continuing.