Skip to content

fix: handle new organization structure in user data#136

Merged
BennyKok merged 1 commit intomainfrom
dev
Sep 2, 2025
Merged

fix: handle new organization structure in user data#136
BennyKok merged 1 commit intomainfrom
dev

Conversation

@KarrixLee
Copy link
Collaborator

Here's a concise PR description:

Fix: Add backward compatibility for Clerk's updated user data structure

Problem:
Clerk recently updated their user data structure, replacing the direct org_id field with an o object containing organization data. This broke organization-based functionality across the application.

Solution:
Added backward compatibility in the auth middleware to extract org_id from the new o.id structure when the legacy org_id field is not present.

Changes:

  • Updated get_current_user() in auth.py to handle both old and new Clerk token formats
  • Maintains full backward compatibility - no other code changes required
  • Removed debug print statement

Testing:

  • ✅ Works with existing users who have organizations
  • ✅ Works with users without organizations
  • ✅ Maintains compatibility with API tokens

References:
Clerk Auth Object Documentation

@BennyKok BennyKok merged commit dd360fe into main Sep 2, 2025
4 checks passed
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