kroo / kroo/reflex-clerk

Ticket Response Model Verification - Invite Links

Open
#22 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
29
Forks
17
PR merge metrics
No merged PRs in 30d

Description

I was having trouble with the email invite function of clerk

When a user would accept the email invite and complete sign up, the intended redirect to the home page would raise the following error on the backend

```
[Reflex Backend Exception]
Traceback (most recent call last):
File
"/usr/local/lib/python3.11/site-packages/reflex_clerk/clerk_client/clerk_client.
py", line 22, in _handle_response
return response_model.parse_obj(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pydantic/main.py", line 1135, in
parse_obj
return cls.model_validate(obj)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pydantic/main.py", line 568, in
model_validate
return cls.__pydantic_validator__.validate_python(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for User
email_addresses.0.verification.strategy
Input should be 'oauth_google', 'oauth_mock', 'admin', 'phone_code',
'email_code', 'reset_password_email_code', 'web3_metamask_signature' or
'from_oauth_google'
For further information visit
https://errors.pydantic.dev/2.8/v/literal_error

... more trace ...

ValueError: Failed to parse response
'{"id":"","object":"user","username":"","f
irst_name":null,"last_name":null,"image_url":"","has_image":false,"primary_email_addre
ss_id":" ","primary_phone_number_id":null,"primary
_web3_wallet_id":null,"password_enabled":true,"two_factor_enabled":false,"totp_e
nabled":false,"backup_code_enabled":false,"email_addresses":[{"id":"","object":"email_address","email_address":"","reserved":false,"verification":{"status":"verified","strategy":"ticket","a
ttempts":null,"expire_at":null},"linked_to":[],"created_at":1731091851092,"updat
ed_at":1731091851162}],"phone_numbers":[],"web3_wallets":[],"passkeys":[],"exter
nal_accounts":[],"saml_accounts":[],"public_metadata":{},"private_metadata":{},"
unsafe_metadata":{},"external_id":null,"last_sign_in_at":1731091868233,"banned":
false,"locked":false,"lockout_expires_in_seconds":null,"verification_attempts_re
maining":30,"created_at":1731091851117,"updated_at":1731091868281,"delete_self_e
nabled":false,"create_organization_enabled":true,"last_active_at":1731091851117,
"mfa_enabled_at":null,"mfa_disabled_at":null,"legal_accepted_at":null,"profile_i
mage_url":"https://www.gravatar.com/avatar?d=mp"}' as User
```

the error seems to be raised by`"verification":{"status":"verified","strategy":"ticket"}`

Looking at the [docs](https://kroo.github.io/reflex-clerk/clerk_state/#reflex_clerk.clerk_client.clerk_response_models.Verification) for verification strategies, 'ticket' seems to be missing from the list of available strategies

I added 'ticket' to the possible strategy options and it fixed the problem

Let me know if this "fix" seems complete!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Verification response model documented at reflex_clerk.clerk_client.clerk_response_models.Verification and compare its accepted strategies with the Clerk response shown in the issue. Reproduce the email invite flow and confirm that a verified email using the ticket strategy parses without the backend validation error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.