Skip to content

Conversation

jappi00
Copy link

@jappi00 jappi00 commented Sep 15, 2025

Hello everyone,

I encountered some issues with the provider from the documentation. I found an updated version directly from WorkOS here: https://github.com/workos/template-convex-nextjs-authkit/blob/main/components/ConvexClientProvider.tsx

I'm not entirely sure if I did this PR correctly! 😅


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jappi00 jappi00 changed the title Update authkit.mdx Improved Workos Convex Provider to work with org switching Sep 15, 2025
@jappi00 jappi00 force-pushed the improved-provider-workos-docs branch from c19e8ea to 227c591 Compare September 15, 2025 13:22
@jappi00 jappi00 changed the title Improved Workos Convex Provider to work with org switching DOCS: Improved Workos Convex Provider to work with org switching Sep 15, 2025
@thomasballinger
Copy link
Contributor

Thanks @jappi00 , this looks reasonable to me! I want to hold off because we're actively making changes to https://github.com/workos/template-convex-nextjs-authkit still; we'll get this change (or something similar) in soon. Do you see org switching working with this code but not with the current implementation?

@jappi00
Copy link
Author

jappi00 commented Sep 16, 2025

thanks for the quick answer @thomasballinger!

Yes, I only get it to work with the updated Provider:

With the old one it only works after a refresh of the page (before the backend auth does not get refreshed.)

That is how I switch the organizations:

import { useAuth } from "@workos-inc/authkit-nextjs/components";

// Switch organization context
await refreshAuth({ organizationId: team.workos_id });

Once I've polished the complete implementation, I'd like to extend the documentation to cover organization switching and user syncing, unless you have any objections.

@jappi00
Copy link
Author

jappi00 commented Sep 17, 2025

For more Context: workos/template-convex-nextjs-authkit@afd8097

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants