Skip to content

Conversation

@supmo668
Copy link

Summary

This PR adds phone number support to the ClerkUser state class, enabling applications to access and manage user phone numbers through the Clerk API.

Changes

  • Added phone_number and phone_number_id properties to ClerkUser state
  • Added update_phone_number method to ClerkUser for updating user phone numbers
  • Added update_user_phone_number helper function for use in custom event handlers
  • Load phone number data in the load_user event handler

Usage Example

import reflex_clerk_api as clerk

class MyState(rx.State):
    @rx.event
    async def update_my_phone(self) -> EventType:
        # Using the helper function
        new_phone = await clerk.update_user_phone_number(self, '+12025551234')
        return rx.toast.success(f'Phone updated: {new_phone.phone_number}')

Notes

  • Phone numbers are stored in E.164 format (e.g., +12025551234)
  • The phone_number_id is needed for updating/deleting phone numbers via Clerk API
  • When a new phone number is set, the old one is automatically deleted

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds phone number support to the ClerkUser state so apps can read and update a user’s phone number via the Clerk backend API.

Changes:

  • Adds phone_number and phone_number_id to ClerkUser and loads them in load_user.
  • Introduces ClerkUser.update_phone_number plus a standalone update_user_phone_number helper.
  • Adds a GitHub Actions workflow intended to sync a fork with upstream.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 10 comments.

File Description
custom_components/reflex_clerk_api/clerk_provider.py Adds phone number fields, loading, and update APIs for Clerk users.
.github/workflows/sync-upstream.yml Adds an automated upstream sync workflow (not related to phone number support).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

supmo668 added a commit to supmo668/reflex-clerk-api that referenced this pull request Jan 27, 2026
- Remove unrelated sync-upstream.yml workflow (should be in separate PR)
- Fix primary phone number selection to use primary_phone_number_id
- Refactor ClerkUser.update_phone_number to use helper (DRY principle)
- Add verified parameter (default False) for security-conscious phone updates
- Fix PII logging: use DEBUG level, redact sensitive identifiers
- Fix docstring: remove incorrect 'unchanged' return case
- Export update_user_phone_number in __init__.py

Addresses Copilot code review comments on PR TimChild#19
- Add phone_number and phone_number_id properties to ClerkUser
- Add update_phone_number method with verified parameter (default: False)
- Add update_user_phone_number helper function for custom handlers
- Load primary phone number in load_user event handler
- Export update_user_phone_number in package __init__.py
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.

1 participant