Sharing Convex Authentication State Between Main App and Share Extension in React Native
I'm building a React Native app with Convex and Clerk for authentication. I'm trying to implement a share extension that needs to access the authenticated Convex state from the main app.
Even though the Clerk token is being shared successfully through the keychain access group, the share extension still shows as unauthenticated in Convex (
Current Setup
- Main App:
- Using Clerk for authentication
- Using
for Convex integrationConvexProviderWithClerk - Token caching implemented with
and keychain access group sharingexpo-secure-store
- Share Extension:
- Separate entry point (
)index.share.js - Same Clerk and Convex configuration as main app
- Using the same token cache with keychain access group
- Separate entry point (
- Set up keychain sharing between main app and share extension:```typescriptconst createTokenCache = (): TokenCache => ({getToken: async (key: string) => { const item = await SecureStore.getItemAsync(key, { keychainAccessGroup: "group.com.***.***" }); // ...},// ...});```
- Confirmed that Clerk tokens are being shared (I can see the
in the logs)__clerk_client_jwt - Using
in the share extension:useConvexAuth()
Even though the Clerk token is being shared successfully through the keychain access group, the share extension still shows as unauthenticated in Convex (
isAuthenticated is false), despite the main app being authenticated.Questions
- Is there anything special needed to make Convex recognize the shared Clerk authentication state in the share extension?
- Are there any specific configuration requirements for Convex to work with share extensions?
- Is there a recommended pattern for sharing authentication state between a main app and its share extension when using Convex?