Skip to content

Reflex custom components for integrating Clerk authentication

Notifications You must be signed in to change notification settings

TimChild/reflex-clerk-api

Repository files navigation

Test Status PyPi publish Status Demo Deploy Status

reflex-clerk-api

A Reflex custom component for integrating Clerk authentication into a Reflex application.

See a Demo.

See the Docs

Installation

Any of:

uv add reflex-clerk-api

pip install reflex-clerk-api

poetry add reflex-clerk-api

Usage

import reflex_clerk_api as clerk

def index() -> rx.Component:
    return clerk.clerk_provider(
        rx.container(
            clerk.clerk_loaded(
                clerk.signed_in(
                    clerk.sign_on(
                        rx.button("Sign out"),
                    ),
                ),
                clerk.signed_out(
                    rx.button("Sign in"),
                ),
            ),
        ),
        publishable_key=os.environ["CLERK_PUBLISHABLE_KEY"],
        secret_key=os.environ["CLERK_SECRET_KEY"],
        register_user_state=True,
    )

Contributing

Feel free to open issues or make PRs.

Usual process for contributing:

  • Fork the repo
  • Make changes on a feature branch
  • Ideally, add tests for any changes (this will mean your changes don't get broken in the future too).
  • Submit a PR

I use Taskfile (similar to makefile) to make common tasks easier. If you have that installed, you can run:

  • task install -- Install dev dependencies and pre-commit.
  • task run -- Run the demo locally
  • task run-docs -- Run the docs locally
  • task test -- Run tests
  • task bump-patch/minor/major -- Bump the version (patch for a bug fix, minor for an added feature).

TODO:

  • How should the condition and fallback props be defined on Protect? They are supposed to be Javascript and JSX respectively, but are just str for now... Is Javascript rx.Script? And JSX rx.Component?

About

Reflex custom components for integrating Clerk authentication

Resources

Stars

Watchers

Forks

Packages