Clear MFA state when your app is backgrounded so users must re-verify on their next session
By default, Privy caches the MFA token after verification and skips re-prompting until it expires.
Apps that need fresh verification on every launch can clear the cached token whenever the app moves
to the background. A trading app, for example, might treat each app open as a new security session.This recipe uses React Native’s AppState API and Privy’s clear method from useMfa to tie MFA
verification to app session lifecycle.
Register an AppState listener in a component near the root of your app. When the app leaves the
active state — backgrounded or inactive — clear the MFA token:
import {useEffect} from 'react';import {AppState} from 'react-native';import {useMfa} from '@privy-io/expo';export default function AppSessionMfaGuard() { const {clear} = useMfa(); useEffect(() => { const subscription = AppState.addEventListener('change', (nextState) => { if (nextState !== 'active') { clear(); } }); return () => subscription.remove(); }, [clear]); return null;}
Render <AppSessionMfaGuard /> inside PrivyProvider, near the root of your app:
import {PrivyProvider} from '@privy-io/expo';import AppSessionMfaGuard from './AppSessionMfaGuard';export default function App() { return ( <PrivyProvider appId="your-privy-app-id" clientId="your-privy-client-id"> <AppSessionMfaGuard /> {/* rest of your app */} </PrivyProvider> );}
Wallet actions naturally re-trigger MFA after clear(). To prompt immediately on foreground
instead, call prompt() when the app returns to active:
import {useEffect, useRef} from 'react';import {AppState, AppStateStatus} from 'react-native';import {useMfa} from '@privy-io/expo';export default function AppSessionMfaGuard() { const {clear, prompt} = useMfa(); const appState = useRef<AppStateStatus>(AppState.currentState); useEffect(() => { const subscription = AppState.addEventListener('change', async (nextState) => { const previousState = appState.current; appState.current = nextState; if (nextState !== 'active') { // App is going to the background — clear the cached MFA token clear(); } else if (previousState !== 'active' && nextState === 'active') { // App is returning to the foreground — proactively prompt for MFA await prompt(); } }); return () => subscription.remove(); }, [clear, prompt]); return null;}
prompt() no-ops when the user has no MFA methods enrolled. Because clear() runs on every
background event, there is never a cached token on resume. The user is always prompted.
By default, MFA tokens stay valid for 15 minutes. For a session-based approach, a longer cache
prevents mid-session expiry. clear() then handles explicit invalidation on background.Configure the MFA token duration in the
Privy Dashboard. Setting a value of several
hours ensures no mid-session re-prompts while the user is active.
On iOS, apps that move to the background have limited time before execution suspends. clear() makes
no network requests and operates only on local state. It completes reliably within iOS background
execution limits.
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Privy Docs","colors":{"primary":"#010110","light":"#FFFFFF"},"logo":{"light":"https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-light.png?fit=max\u0026auto=format\u0026n=Ih_Fo3QYM486gzWq\u0026q=85\u0026s=bd297b680ace8a13db4d9ce977f93180","dark":"https://mintcdn.com/privy-c2af3412/Ih_Fo3QYM486gzWq/logo/privy-logo-dark.png?fit=max\u0026auto=format\u0026n=Ih_Fo3QYM486gzWq\u0026q=85\u0026s=24d83970695ab19a1803a2eb00dbea4e"},"favicon":"https://mintcdn.com/privy-c2af3412/YByWVKlFbSpnpSJG/favicon.png?fit=max\u0026auto=format\u0026n=YByWVKlFbSpnpSJG\u0026q=85\u0026s=ee4038168ea586e5f72041e5e2a1f5c8","api":{"openapi":{"source":"https://api.staging.privy.io/v1/openapi.json"},"playground":{"display":"interactive"},"examples":{"languages":["curl","java","javascript","php","go"]},"mdx":{"server":"https://api.privy.io"}},"background":{"color":{"light":"#FFFFFF","dark":"#010110"}},"navbar":{"links":[{"href":"https://demo.privy.io","label":"Demo"},{"href":"https://privy.io/slack","label":"Support"}],"primary":{"type":"button","label":"Dashboard","href":"https://dashboard.privy.io"}},"seo":{"metatags":{"og:type":"website","og:site_name":"Privy Docs","og:image":"https://assets.privy.io/docs-og.png","twitter:title":"Privy Docs","twitter:card":"summary_large_image","twitter:image":"https://assets.privy.io/docs-og.png"},"organization":{"id":"https://www.privy.io/#organization","name":"Privy","url":"https://www.privy.io","logo":"https://assets.privy.io/docs-og.png","sameAs":["https://x.com/privy_io","https://github.com/privy-io"]}},"styling":{"codeblocks":"system","latex":true},"integrations":{"gtm":{"tagId":"GTM-WV9MVTB3"}},"contextual":{"options":["claude","chatgpt","cursor","vscode","mcp","copy","view"],"display":"header"},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"privy-c2af3412","hasAudioNarration":false,"actualSubdomain":"privy-c2af3412","customDomains":["docs.privy.io"],"gitSource":{"type":"github","owner":"privy-io","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"issues":true,"thumbs":true,"edits":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6af65053b373203ca78c457b","clientVersion":"0.0.4124","searchFilterCounts":[{"language":"default","tag":"Wallets","count":296},{"language":"default","tag":"API reference","count":255},{"language":"default","tag":"Identity","count":142},{"language":"default","tag":"Recipes","count":139},{"language":"default","tag":"All recipes","count":138},{"language":"default","tag":"Signatures and transactions","count":91},{"language":"default","tag":"Financial flows","count":88},{"language":"default","tag":"Users","count":87},{"language":"default","tag":"Basics","count":86},{"language":"default","tag":"Controls","count":77}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","href":"/_mintlify/custom/privy-c2af3412/106de3f982828597/style.css"}],"page":{"pagePath":"recipes/react-native/mfa-on-app-session","slug":"/recipes/react-native/mfa-on-app-session","pageMetadata":{"title":"Require MFA on every app session","description":"Clear MFA state when your app is backgrounded so users must re-verify on their next session","keywords":["MFA","multi-factor authentication","app session","app background","React Native","Expo","AppState"],"href":"/recipes/react-native/mfa-on-app-session"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Clear MFA state when your app is backgrounded so users must re-verify on their next session\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,..._provideComponents(),...props.components},{CodeBlock,Heading,Note}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`By default, Privy caches the MFA token after verification and skips re-prompting until it expires.\nApps that need fresh verification on every launch can clear the cached token whenever the app moves\nto the background. A trading app, for example, might treat each app open as a new security session.`}),`\n`,_jsxs(_components.p,{children:[`This recipe uses React Native’s `,_jsx(_components.code,{children:`AppState`}),` API and Privy’s `,_jsx(_components.code,{children:`clear`}),` method from `,_jsx(_components.code,{children:`useMfa`}),` to tie MFA\nverification to app session lifecycle.`]}),`\n`,_jsx(Heading,{level:`2`,id:`how-it-works`,children:`How it works`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`The user opens the app, authenticates, and proceeds normally. Wallet actions trigger MFA as usual.`}),`\n`,_jsxs(_components.li,{children:[`When the user backgrounds the app, `,_jsx(_components.code,{children:`clear()`}),` invalidates the cached MFA token.`]}),`\n`,_jsx(_components.li,{children:`When the user returns and performs a wallet action, Privy finds no valid token and prompts for\nfresh verification.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`implementation`,children:`Implementation`}),`\n`,_jsxs(_components.p,{children:[`Register an `,_jsx(_components.code,{children:`AppState`}),` listener in a component near the root of your app. When the app leaves the\n`,_jsx(_components.code,{children:`active`}),` state — backgrounded or inactive — clear the MFA token:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`19`,language:`tsx`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`tsx`,children:_jsxs(_components.code,{language:`tsx`,numberOfLines:`19`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`useEffect`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'react'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`AppState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'react-native'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`useMfa`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@privy-io/expo'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` default`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` AppSessionMfaGuard`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`clear`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` useMfa`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` useEffect`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(() `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` subscription`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` AppState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`addEventListener`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'change'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`nextState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`nextState`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'active'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` clear`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` () `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` subscription`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`remove`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }, [`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`clear`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Render `,_jsx(_components.code,{children:`\u003cAppSessionMfaGuard />`}),` inside `,_jsx(_components.code,{children:`PrivyProvider`}),`, near the root of your app:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`tsx`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`tsx`,children:_jsxs(_components.code,{language:`tsx`,numberOfLines:`11`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`PrivyProvider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@privy-io/expo'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` AppSessionMfaGuard`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` './AppSessionMfaGuard'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` default`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` App`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#4EC9B0`},children:`PrivyProvider`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` appId`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"your-privy-app-id\"`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:` clientId`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"your-privy-client-id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#4EC9B0`},children:`AppSessionMfaGuard`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` />`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` {`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`/* rest of your app */`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:` \u003c/`}),_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#4EC9B0`},children:`PrivyProvider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#808080`},children:`>`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` );`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`proactively-prompting-on-app-resume`,children:`Proactively prompting on app resume`}),`\n`,_jsxs(_components.p,{children:[`Wallet actions naturally re-trigger MFA after `,_jsx(_components.code,{children:`clear()`}),`. To prompt immediately on foreground\ninstead, call `,_jsx(_components.code,{children:`prompt()`}),` when the app returns to `,_jsx(_components.code,{children:`active`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`27`,language:`tsx`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`tsx`,children:_jsxs(_components.code,{language:`tsx`,numberOfLines:`27`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`useEffect`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`useRef`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'react'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`AppState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`AppStateStatus`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'react-native'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`useMfa`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '@privy-io/expo'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`export`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` default`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` function`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` AppSessionMfaGuard`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`clear`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`prompt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`} `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` useMfa`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` appState`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` useRef`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:`AppStateStatus`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`>(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`AppState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`currentState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` useEffect`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(() `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` subscription`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` AppState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`addEventListener`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'change'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`async`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`nextState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` previousState`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` appState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`current`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` appState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`current`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nextState`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`nextState`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'active'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // App is going to the background — clear the cached MFA token`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` clear`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`else`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`previousState`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` !==`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'active'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` \u0026\u0026`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` nextState`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` ===`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'active'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // App is returning to the foreground — proactively prompt for MFA`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` prompt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` () `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` subscription`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`remove`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }, [`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`clear`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`prompt`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` return`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` null`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.code,{children:`prompt()`}),` no-ops when the user has no MFA methods enrolled. Because `,_jsx(_components.code,{children:`clear()`}),` runs on every\nbackground event, there is never a cached token on resume. The user is always prompted.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`extending-the-cache-duration`,children:`Extending the cache duration`}),`\n`,_jsxs(_components.p,{children:[`By default, MFA tokens stay valid for 15 minutes. For a session-based approach, a longer cache\nprevents mid-session expiry. `,_jsx(_components.code,{children:`clear()`}),` then handles explicit invalidation on background.`]}),`\n`,_jsxs(_components.p,{children:[`Configure the MFA token duration in the\n`,_jsx(_components.a,{href:`https://dashboard.privy.io/admin/mfa-cache-duration`,children:`Privy Dashboard`}),`. Setting a value of several\nhours ensures no mid-session re-prompts while the user is active.`]}),`\n`,_jsx(Heading,{level:`2`,id:`ios-background-constraints`,children:`iOS background constraints`}),`\n`,_jsxs(_components.p,{children:[`On iOS, apps that move to the background have limited time before execution suspends. `,_jsx(_components.code,{children:`clear()`}),` makes\nno network requests and operates only on local state. It completes reliably within iOS background\nexecution limits.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":"system","config":{},"pageMetadata":{"title":"Require MFA on every app session","description":"Clear MFA state when your app is backgrounded so users must re-verify on their next session","keywords":["MFA","multi-factor authentication","app session","app background","React Native","Expo","AppState"],"href":"/recipes/react-native/mfa-on-app-session"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"How it works","slug":"how-it-works","depth":2,"children":[]},{"title":"Implementation","slug":"implementation","depth":2,"children":[]},{"title":"Proactively prompting on app resume","slug":"proactively-prompting-on-app-resume","depth":2,"children":[]},{"title":"Extending the cache duration","slug":"extending-the-cache-duration","depth":2,"children":[]},{"title":"iOS background constraints","slug":"ios-background-constraints","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/privy-c2af3412/9a6cfa36ced76db0/welcome.js","/_mintlify/custom/privy-c2af3412/1af79d46bd64cd8b/fullstory.js","/_mintlify/custom/privy-c2af3412/e4d91321024fde21/recipes/recipes-search.js","/_mintlify/custom/privy-c2af3412/d31c5451398ab22c/check-links.js"],"subdomain":"privy-c2af3412","siteName":"Privy Docs","title":"Require MFA on every app session - Privy Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-06-04T14:23:09.434Z","originalFileLocation":"recipes/react-native/mfa-on-app-session.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Clear MFA state when your app is backgrounded so users must re-verify on their next session\">\u003cmeta data-mint-head name=\"application-name\" content=\"Privy Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/privy-c2af3412/bJgmnaRQwH8sO8y5/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/privy-c2af3412/bJgmnaRQwH8sO8y5/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/privy-c2af3412/bJgmnaRQwH8sO8y5/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/privy-c2af3412/bJgmnaRQwH8sO8y5/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/privy-c2af3412/bJgmnaRQwH8sO8y5/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/privy-c2af3412/bJgmnaRQwH8sO8y5/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/privy-c2af3412/bJgmnaRQwH8sO8y5/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/privy-c2af3412/bJgmnaRQwH8sO8y5/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/privy-c2af3412/bJgmnaRQwH8sO8y5/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Require MFA on every app session - Privy Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Clear MFA state when your app is backgrounded so users must re-verify on their next session\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Privy Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.privy.io/recipes/react-native/mfa-on-app-session\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://assets.privy.io/docs-og.png\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Privy Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Clear MFA state when your app is backgrounded so users must re-verify on their next session\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://assets.privy.io/docs-og.png\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/privy-c2af3412/bJgmnaRQwH8sO8y5/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Privy Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#010110\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.privy.io/recipes/react-native/mfa-on-app-session\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/recipes/react-native/mfa-on-app-session.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://www.privy.io/#organization\",\"name\":\"Privy\",\"url\":\"https://www.privy.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://assets.privy.io/docs-og.png\"},\"sameAs\":[\"https://x.com/privy_io\",\"https://github.com/privy-io\"]},{\"@type\":\"WebSite\",\"@id\":\"https://docs.privy.io#website\",\"name\":\"Privy Docs\",\"url\":\"https://docs.privy.io\",\"publisher\":{\"@id\":\"https://www.privy.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.privy.io/recipes/react-native/mfa-on-app-session#webpage\",\"url\":\"https://docs.privy.io/recipes/react-native/mfa-on-app-session\",\"name\":\"Require MFA on every app session\",\"description\":\"Clear MFA state when your app is backgrounded so users must re-verify on their next session\",\"dateModified\":\"2026-06-04T14:23:09.434Z\",\"isPartOf\":{\"@id\":\"https://docs.privy.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.privy.io/recipes/react-native/mfa-on-app-session#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.privy.io/recipes/react-native/mfa-on-app-session#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"All recipes\",\"item\":\"https://docs.privy.io/recipes/authentication/overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Mobile\",\"item\":\"https://docs.privy.io/recipes/mobile-key-export\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Require MFA on every app session\",\"item\":\"https://docs.privy.io/recipes/react-native/mfa-on-app-session\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.privy.io/recipes/react-native/mfa-on-app-session#article\",\"headline\":\"Require MFA on every app session\",\"name\":\"Require MFA on every app session\",\"description\":\"Clear MFA state when your app is backgrounded so users must re-verify on their next session\",\"url\":\"https://docs.privy.io/recipes/react-native/mfa-on-app-session\",\"mainEntityOfPage\":{\"@id\":\"https://docs.privy.io/recipes/react-native/mfa-on-app-session#webpage\"},\"image\":\"https://assets.privy.io/docs-og.png\",\"dateModified\":\"2026-06-04T14:23:09.434Z\",\"keywords\":\"MFA, multi-factor authentication, app session, app background, React Native, Expo, AppState\",\"publisher\":{\"@id\":\"https://www.privy.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.privy.io#website\"}}]}\u003c/script>","agentPointerHref":"/recipes/react-native/mfa-on-app-session.md","siteName":"Privy Docs","nav":{"global":null,"tabs":[{"tab":"Basics","pages":[{"title":"Basics","href":"/basics/get-started/about"}]},{"tab":"Wallets","menu":[{"item":"Overview","pages":[{"title":"Overview","href":"/wallets/overview"}]},{"item":"Embedded wallets","pages":[{"title":"Embedded wallets","href":"/wallets/overview/embedded"}]},{"item":"Organization wallets","pages":[{"title":"Organization wallets","href":"/organizations/overview"}]},{"item":"External wallets","pages":[{"title":"External wallets","href":"/wallets/connectors/overview"}]},{"item":"Signatures and transactions","pages":[{"title":"Signatures and transactions","href":"/wallets/signatures-and-transactions"}]},{"item":"Balances and webhooks","pages":[{"title":"Balances and webhooks","href":"/wallets/gas-and-asset-management/assets/overview"}]},{"item":"Gas and fee management","pages":[{"title":"Gas and fee management","href":"/wallets/gas-and-asset-management/gas/overview"}]}],"pages":[{"title":"Wallets","href":"/wallets/overview"}]},{"tab":"Financial flows","menu":[{"item":"Overview","pages":[{"title":"Overview","href":"/financial-flows/overview"}]},{"item":"Deposits","pages":[{"title":"Deposits","href":"/financial-flows/deposits/overview"}]},{"item":"Payouts","pages":[{"title":"Payouts","href":"/financial-flows/payouts/overview"}]},{"item":"Earn","pages":[{"title":"Earn","href":"/wallets/actions/earn/overview"}]},{"item":"Cards","pages":[{"title":"Cards","href":"/financial-flows/cards/overview"}]},{"item":"Trade","pages":[{"title":"Trade","href":"/wallets/actions/swap/overview"}]},{"item":"Monetization","pages":[{"title":"Monetization","href":"/financial-flows/monetization"}]},{"item":"Treasury management","pages":[{"title":"Treasury management","href":"/treasury-management/overview"}]},{"item":"Private transactions","pages":[{"title":"Private transactions","href":"/financial-flows/private-transactions"}]}],"pages":[{"title":"Financial flows","href":"/financial-flows/overview"}]},{"tab":"Controls and policies","menu":[{"item":"Controls","pages":[{"title":"Controls","href":"/controls/overview"}]},{"item":"Policies","pages":[{"title":"Policies","href":"/controls/policies/overview"}]},{"item":"Manual approvals","pages":[{"title":"Manual approvals","href":"/controls/dashboard/overview"}]}],"pages":[{"title":"Controls and policies","href":"/controls/overview"}]},{"tab":"Identity","menu":[{"item":"Authentication","pages":[{"title":"Authentication","href":"/authentication/overview"}]},{"item":"Users","pages":[{"title":"Users","href":"/user-management/users/overview"}]},{"item":"KYC and KYB","pages":[{"title":"KYC and KYB","href":"/kyc-kyb/overview"}]}],"pages":[{"title":"Identity","href":"/authentication/overview"}]},{"tab":"Security","pages":[{"title":"Security","href":"/security/overview"}]},{"tab":"Recipes","pages":[{"title":"Recipes","sidebarTitle":"Overview","mode":"wide","href":"/recipes/overview"},{"group":"All recipes","pages":[{"group":"Authentication","expanded":false,"pages":[{"sidebarTitle":"Overview","title":"Authentication","href":"/recipes/authentication/overview"},{"title":"Setting up SMS or WhatsApp login","href":"/recipes/dashboard/login-methods/sms-whatsapp"},{"title":"Guest accounts","href":"/recipes/react/guest-accounts"},{"title":"Login with Apple","href":"/recipes/swift/apple"},{"title":"Login with Farcaster","href":"/recipes/farcaster/login"},{"title":"Login with Lens","href":"/recipes/lens"},{"title":"Use tokens from OAuth providers","href":"/recipes/react/oauth-tokens"},{"title":"Migrating embedded wallets from Alchemy to Privy","href":"/recipes/migrating-embedded-wallets-from-alchemy"},{"title":"Migrating JWT authentication from Alchemy to Privy","href":"/recipes/migrating-jwt-authentication-from-alchemy"},{"title":"Using Supabase as an authentication provider","href":"/recipes/authentication/using-supabase-for-custom-auth"},{"title":"Worldcoin mini app SIWE with Privy","href":"/recipes/react/worldcoin-siwe-guide"},{"title":"Chrome extension authentication","href":"/recipes/react/chrome-extension"},{"title":"Mocking tokens for testing","href":"/recipes/mock-jwt"},{"title":"Configure cookies","href":"/recipes/react/cookies"},{"title":null,"href":"/recipes/using-test-accounts"},{"title":"Migrating sign in with Apple users for an Apple team transfer","href":"/recipes/apple-team-migration"}]},{"group":"Wallet infrastructure","expanded":false,"pages":[{"sidebarTitle":"Overview","title":"Wallet infrastructure","href":"/recipes/wallet-infrastructure/overview"},{"title":"Hierarchical deterministic (HD) wallets","href":"/recipes/hd-wallets"},{"title":"Pregenerating wallets","href":"/recipes/pregenerate-wallets"},{"sidebarTitle":"Agentic wallets","title":"Agentic wallets","href":"/recipes/agent-integrations/agentic-wallets"},{"title":"Server-side user wallets","href":"/recipes/wallets/server-side-user-wallets"},{"title":"Enabling users or servers to execute transactions","href":"/recipes/wallets/user-and-server-signers"},{"title":"Using passkeys with wallets","href":"/recipes/passkey-server-wallets"},{"title":"Policy-based MFA","href":"/recipes/policy-based-mfa"},{"title":"Using stateful policies with Privy","href":"/recipes/using-stateful-policies"},{"title":"Migrating wallets from on-device to TEEs","href":"/recipes/tee-wallet-migration-guide"},{"title":"Tier 1 wallet integration","href":"/recipes/tier-1-wallet-integration"},{"title":"Tier 2 wallet integration","href":"/recipes/tier-2-wallet-integration"},{"title":"Custom account abstraction implementation","href":"/recipes/account-abstraction/custom-implementation"},{"title":"Storing smart account addresses","href":"/recipes/account-abstraction/address"},{"title":"Integrating smart accounts with wagmi","href":"/recipes/account-abstraction/wagmi"},{"title":"Create a smart wallet on iOS and Android","href":"/recipes/account-abstraction/native-mobile"},{"title":"2-of-2 quorum: user and server as co-signers","href":"/recipes/wallets/two-of-two-server-in-the-loop"}]},{"group":"Account funding","expanded":false,"pages":[{"sidebarTitle":"Overview","title":"Account funding","href":"/recipes/account-funding/overview"},{"title":"Stripe embedded onramp","href":"/recipes/stripe-embedded-onramp"},{"title":"Using Privy and Due for on/off ramping","href":"/recipes/due-on-off-ramp"},{"title":"Onramping to MXNB with Juno","href":"/recipes/bitso-mxnb-onramp"}]},{"group":"Transactions \u0026 signing","expanded":false,"pages":[{"group":"EVM","expanded":false,"pages":[{"sidebarTitle":"Overview","title":"EVM transactions and signing","href":"/recipes/evm/overview"},{"title":"Sending OUSD (or other ERC-20s)","href":"/recipes/send-ousd"},{"title":"Sending USDC (or other ERC-20s)","href":"/recipes/send-usdc"},{"title":"Sending batch transactions","href":"/recipes/batch-transactions"},{"title":"Speeding up transactions on EVM chains","href":"/recipes/speeding-up-transactions"},{"sidebarTitle":"Flashblocks","title":"Using Flashblocks with Privy","href":"/recipes/evm/flashblocks"},{"title":"Integrating with EIP-7702","href":"/recipes/react/eip-7702"},{"title":"ERC-1271 signatures","href":"/recipes/evm/erc-1271-signatures"}]},{"group":"Solana","expanded":false,"pages":[{"sidebarTitle":"Overview","title":"Solana transactions and signing","href":"/recipes/solana/overview"},{"title":"Getting started with Privy and Solana","href":"/recipes/solana/getting-started-with-privy-and-solana"},{"title":"Sending a SOL transaction","href":"/recipes/solana/send-sol"},{"title":"Sending SPL tokens","href":"/recipes/solana/send-spl-tokens"}]},{"group":"Bitcoin","expanded":false,"pages":[{"title":"Using Spark BTC with Privy wallets","href":"/recipes/spark-btc-guide"}]}]},{"group":"Gas sponsorship","expanded":false,"pages":[{"title":"Custom gas sponsorship rate limits","href":"/recipes/gas-sponsorship-rate-limits"},{"title":"Integrating OneBalance","href":"/recipes/one-balance"},{"title":"Sponsor gas on Tron with Transatron","sidebarTitle":"Sponsor gas on Tron with Transatron","href":"/recipes/tron/transatron"}]},{"group":"Treasury","expanded":false,"pages":[{"sidebarTitle":"Overview","title":"Treasury","href":"/recipes/wallets/treasury-overview"},{"sidebarTitle":"Treasury","title":"Treasury setup","href":"/recipes/wallets/wallet-infrastructure"},{"sidebarTitle":"Execution wallets","title":"Execution wallets","href":"/recipes/wallets/execution-wallets"}]},{"group":"Swaps","expanded":false,"pages":[{"title":"Swapping crypto using Privy and 0x","href":"/recipes/swap-with-0x"},{"title":"Swapping crypto using Privy and Bebop","href":"/recipes/evm/bebop-swap-guide"}]},{"group":"Payments","expanded":false,"pages":[{"title":"Pay with WalletConnect pay","href":"/recipes/walletconnect-pay"},{"title":"Bridge cards","href":"/recipes/bridge-cards"},{"title":"Send to Africa with Zuba","href":"/recipes/send-to-africa"},{"title":"Accept stablecoin payments with automatic fiat conversion","href":"/recipes/stablecoin-payments-bridge-stripe"}]},{"group":"Trading","expanded":false,"pages":[{"sidebarTitle":"Overview","title":"Trading","href":"/recipes/trading/overview"},{"title":"Polymarket builder codes","href":"/recipes/polymarket-guide"},{"title":"Trading apps resource page","href":"/recipes/trading-apps-homepage"},{"sidebarTitle":"Server-side access","title":"Enabling server-side access to user wallets","href":"/recipes/wallets/session-signer-use-cases/server-side-access"},{"title":"Bankr Twitter bot guide","href":"/recipes/agent-integrations/bankr-bot-guide"},{"title":"Building a Telegram trading bot","href":"/recipes/telegram-bot"},{"sidebarTitle":"Limit orders","title":"Using signers to execute limit orders with wallets","href":"/recipes/wallets/session-signer-use-cases/limit-orders"},{"title":"Trade on Lighter","href":"/recipes/lighter-guide"}]},{"group":"External wallets","expanded":false,"pages":[{"title":"Wallet list configuration recipes","sidebarTitle":"Wallet list recipes","href":"/recipes/react/wallet-list-configurations"},{"title":"Configuring external connectors","href":"/recipes/react/configuring-external-connectors"},{"title":"Using Solana standard wallets","href":"/recipes/solana/standard-wallets"},{"title":"Integrating Solana mobile wallet adapter","href":"/recipes/solana/adding-solana-mwa"}]},{"group":"Tempo","pages":[{"title":"Overview","href":"/recipes/tempo/overview"},{"title":"Using Tempo with Privy","href":"/recipes/tempo/send-transactions"},{"title":"Receive policies","href":"/recipes/tempo/receive-policies"},{"title":"Deposit from Stellar to Tempo","href":"/recipes/tempo/stellar-deposit-address"}]},{"group":"Hyperliquid","expanded":false,"pages":[{"title":"Quickstart","href":"/recipes/hyperliquid-guide"},{"title":"Agent wallets","href":"/recipes/hyperliquid/agents-and-subaccounts"},{"title":"Executing trades","href":"/recipes/hyperliquid/trading-patterns"},{"title":"Policies","href":"/recipes/hyperliquid/policies-and-offline-actions"},{"title":"HyperEVM","href":"/recipes/hyperliquid/hyperevm"},{"group":"Advanced","expanded":false,"pages":[{"title":"Client-side SDKs","href":"/recipes/hyperliquid/client-side-usage"},{"title":"Subaccounts","href":"/recipes/hyperliquid/subaccounts"},{"title":"Builder codes","href":"/recipes/hyperliquid/builder-codes"}]}]},{"group":"Earn and borrow","expanded":false,"pages":[{"title":"Overview","href":"/recipes/yield/overview"},{"title":"Reading Earn vault totals onchain","sidebarTitle":"Earn totals onchain","href":"/recipes/yield/earn-onchain-totals"},{"sidebarTitle":"Aave","title":"Integrating Aave with Privy","href":"/recipes/yield/aave-guide"},{"sidebarTitle":"Ethena","title":"Integrating Ethena with Privy","href":"/recipes/yield/ethena-guide"},{"sidebarTitle":"Sky savings","title":"Integrating Sky savings with Privy","href":"/recipes/yield/sky-savings-guide"},{"sidebarTitle":"Kamino","title":"Integrating Kamino with Privy","href":"/recipes/yield/kamino-guide"},{"sidebarTitle":"Pods","title":"Integrating Pods with Privy","href":"/recipes/yield/pods-guide"},{"sidebarTitle":"Yield.xyz AgentKit","title":"Using Privy server wallets with yield.xyz AgentKit","href":"/recipes/yield/yield-agentkit-guide"},{"sidebarTitle":"Ground","title":"Integrating Ground gtokens with Privy","href":"/recipes/yield/ground-guide"},{"title":"Borrow with Morpho","sidebarTitle":"Borrow with Morpho","href":"/recipes/yield/morpho-borrow"},{"sidebarTitle":"Dolomite USD1 markets","title":"Earn yield with markets powered by Dolomite","href":"/recipes/community/dolomite-guide"}]},{"group":"AI \u0026 agents","expanded":false,"pages":[{"title":"Overview","href":"/recipes/agent-integrations/overview"},{"sidebarTitle":"AI robo-advisor agent","title":"Build a robo-advisor with Hermes agents and Robinhood chain","href":"/recipes/agent-integrations/robo-advisor-agent"},{"title":"Machine Payments Protocol (MPP)","href":"/recipes/agent-integrations/mpp"},{"title":"x402","href":"/recipes/agent-integrations/x402"},{"title":"Sanctions screening for x402 payments","href":"/recipes/agent-integrations/x402-sanctions-screening"},{"title":"Amazon Bedrock AgentCore","href":"/recipes/agent-integrations/agentcore-payments"},{"title":"OpenClaw agentic wallets","href":"/recipes/agent-integrations/openclaw-agentic-wallets"},{"title":"Privy Agent on auto.exchange","href":"/recipes/agent-integrations/auto-exchange-privy-agent"},{"title":"Virtuals EconomyOS with Privy wallets","sidebarTitle":"Virtuals EconomyOS","href":"/recipes/agent-integrations/virtuals-economyos"}]},{"group":"Social \u0026 mini apps","expanded":false,"pages":[{"title":"Build World mini apps with Privy","href":"/recipes/world/mini-apps"},{"title":"Building a Farcaster mini app","href":"/recipes/farcaster/mini-apps"},{"title":"Writing to Farcaster","href":"/recipes/farcaster/writes"}]},{"group":"UI customization and whitelabeling","expanded":false,"pages":[{"title":"Configuring wallet confirmation modals","href":"/recipes/react/manage-wallet-UIs"},{"title":"Whitelabel","href":"/recipes/react/whitelabel"},{"title":"Setting a system theme for the Privy modal","href":"/recipes/system-theme"}]},{"group":"Dashboard","expanded":false,"pages":[{"title":"Configure account transfer","href":"/recipes/dashboard/account-transfer"},{"title":"Recovering assets from a dashboard wallet","href":"/recipes/dashboard/recovering-assets"},{"title":"Bot traffic mitigation","href":"/recipes/dashboard/preventing-bots"},{"title":"Configure allowed URLs","href":"/recipes/dashboard/allowed-domains"},{"title":"Configure allowed OAuth redirect URLs","href":"/recipes/react/allowed-oauth-redirects"},{"title":"Managing your allowlist with Airtable","href":"/recipes/dashboard/airtable"},{"title":"Customize your application","href":"/recipes/dashboard/customization"},{"title":"Single sign-on","href":"/basics/get-started/dashboard/sso"}]},{"group":"Data","expanded":false,"pages":[{"title":"Analyze Privy data with Stripe","href":"/recipes/data/stripe"}]},{"group":"Mobile","expanded":false,"pages":[{"title":"Exporting wallet keys from mobile apps","href":"/recipes/mobile-key-export"},{"title":"Mobile SDK breadcrumbs","href":"/recipes/mobile-breadcrumbs"},{"title":"Handle account transfer in your mobile app","href":"/recipes/mobile-account-transfer"},{"title":"Read auth state from a background process","href":"/recipes/swift/background-auth-state"},{"title":"Deeplinking Solana wallets in React Native applications","href":"/recipes/react-native/deeplinking-wallets"},{"title":null,"description":null,"href":"/recipes/react-native/clearing-state-on-fresh-installs"},{"title":"Require MFA on every app session","href":"/recipes/react-native/mfa-on-app-session"},{"title":"OAuth with Capacitor","description":null,"href":"/recipes/capacitor-oauth"}]},{"group":"Ecosystem","expanded":false,"pages":[{"title":null,"href":"/recipes/ecosystem/abstract-global-wallet"}]},{"group":"Integrations","expanded":false,"pages":[{"title":"Integrating the Base app","href":"/recipes/react/external-wallets/base-app"},{"sidebarTitle":"Base sub accounts","title":"Using Base sub accounts","href":"/recipes/react/external-wallets/base-sub-accounts"},{"title":"Integrating Base builder codes","href":"/recipes/evm/base-builder-codes"}]},{"group":"Tooling","expanded":false,"pages":[{"title":"Using the vanilla JavaScript SDK","href":"/recipes/core-js"},{"title":"Integrating Flashbots protect","href":"/recipes/flashbots-protect"},{"title":"Integrating with tRPC","href":"/recipes/trpc"},{"title":"Optimize your setup","href":"/recipes/dashboard/optimizing"}]},{"group":"Community written guides","expanded":false,"pages":[{"title":"Getting started with Privy and TON (Vite + React)","href":"/recipes/community/ton-vite-react"},{"title":"Swapping crypto using Privy and Omniston","href":"/recipes/community/ton-omniston-swap"}]}]}]},{"tab":"API reference","pages":[{"title":"API reference","href":"/api-reference/introduction"}]}]},"basePath":"","title":"Require MFA on every app session - Privy Docs","buildId":"dpl_8hoxaqFTU7hTr6A2fUraxAyjuiZo","deploymentId":"dpl_8hoxaqFTU7hTr6A2fUraxAyjuiZo","dynamics":[],"chunks":[]}