Sharing Convex Authentication State Between Main App and Share Extension in React Native
Current Setup
- Main App:
- Using Clerk for authentication
- Using
ConvexProviderWithClerk for Convex integration- Token caching implemented with
expo-secure-store and keychain access group sharing- 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
What I've Done
1. Set up keychain sharing between main app and share extension:
2. Confirmed that Clerk tokens are being shared (I can see the
__clerk_client_jwt in the logs)3. Using
useConvexAuth() in the share extension:The Issue
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
1. Is there anything special needed to make Convex recognize the shared Clerk authentication state in the share extension?
2. Are there any specific configuration requirements for Convex to work with share extensions?
3. Is there a recommended pattern for sharing authentication state between a main app and its share extension when using Convex?
Any guidance would be greatly appreciated!
