Skip to content

Conversation

@Rohitkhapre
Copy link

  • Fix case sensitivity mismatch between agenta_oss_core and agenta_oss_supertokens databases
  • SuperTokens normalizes emails to lowercase during signup/login
  • Agenta was storing emails with original case from invitations
  • This caused 401 errors when users tried to login with mixed case emails

Changes:

  • Make get_user_with_email() case-insensitive using func.lower()
  • Make all invitation-related email lookups case-insensitive
  • Normalize emails to lowercase when creating invitations
  • Normalize emails in create_accounts() function
  • Add comprehensive test to verify the fix

Fixes #2880

- Fix case sensitivity mismatch between agenta_oss_core and agenta_oss_supertokens databases
- SuperTokens normalizes emails to lowercase during signup/login
- Agenta was storing emails with original case from invitations
- This caused 401 errors when users tried to login with mixed case emails

Changes:
- Make get_user_with_email() case-insensitive using func.lower()
- Make all invitation-related email lookups case-insensitive
- Normalize emails to lowercase when creating invitations
- Normalize emails in create_accounts() function
- Add comprehensive test to verify the fix

Fixes Agenta-AI#2880
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Rohit khapre seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working tests labels Nov 6, 2025
@mmabrouk mmabrouk requested review from jp-agenta and junaway November 6, 2025 18:08
@junaway junaway changed the base branch from main to release/v0.62.3 November 14, 2025 13:35
Copy link
Contributor

@junaway junaway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Rohitkhapre,

Thank you for you contribution!

Normalizing inbound email values is definitely a good idea.
Adding normalization to database queries, less so.

After this PR, we must assume that email values will be normalized once they enter our API, and thus our database.
Otherwise it is very likely that, in the future, this issue creeps in again, in a different place, because of already-corrupted data.

What I suggest is, let's:

  • keep normalization in API endpoints
  • remove normalization in database queries
  • fix corrupted data in the database (either manually or by adding a clean omnipotent data migration)

What do you think ?
Do you feel like giving it a try ?

@junaway junaway changed the title fix: resolve email case sensitivity causing 401 authentication errors [fix] resolve email case sensitivity causing 401 authentication errors Nov 14, 2025
@junaway junaway changed the base branch from release/v0.62.3 to release/v0.62.4 November 17, 2025 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AGE-3374] [Bug] Invited users receive 401 Unauthorized after successful signup - cannot join workspace

3 participants