Skip to content

chore(expo): Set default token cache to Expo Secure Store #6281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/expo/src/provider/ClerkProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { Without } from '@clerk/types';
import * as WebBrowser from 'expo-web-browser';

import type { TokenCache } from '../cache/types';
import { tokenCache as secureStoreTokenCache } from '../token-cache';
import { isNative, isWeb } from '../utils/runtime';
import { getClerkInstance } from './singleton';
import type { BuildClerkOptions } from './singleton/types';
Expand All @@ -17,7 +18,7 @@ export type ClerkProviderProps = Without<React.ComponentProps<typeof ClerkReactP
publishableKey?: string;
/**
* The token cache is used to persist the active user's session token. Clerk stores this token in memory by default, however it is recommended to use a token cache for production applications.
* @see https://clerk.com/docs/quickstarts/expo#configure-the-token-cache-with-expo
* @see https://clerk.com/docs/quickstarts/expo#configure-the-token-cache
*/
tokenCache?: TokenCache;
/**
Expand Down Expand Up @@ -69,7 +70,7 @@ export function ClerkProvider(props: ClerkProviderProps): JSX.Element {
isNative()
? getClerkInstance({
publishableKey: pk,
tokenCache,
tokenCache: tokenCache || secureStoreTokenCache,
__experimental_passkeys,
__experimental_resourceCache,
})
Expand Down