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.
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!1 Reply
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!