OpenAuth is a universal provider for managing user authentication. By deploying OpenAuth on Cloudflare Workers, you can add scalable authentication to your application. This demo showcases login, user registration, and password reset, with storage and state powered by D1 and KV.
Important
When using C3 to create this project, select "no" when it asks if you want to deploy. You need to follow this project's setup steps before deploying.
Outside of this repo, you can start a new project with this template using C3 (the create-cloudflare CLI):
npm create cloudflare@latest -- --template=cloudflare/templates/winter-cake-7de7A live public deployment of this template is available at https://winter-cake-7de7.templates.workers.dev
- Install the project dependencies with a package manager of your choice:
npm install
- Create a D1 database with the name "rapid-darkness-e8b8-d1":
...and update the
npx wrangler d1 create rapid-darkness-e8b8-d1
database_idfield inwrangler.jsonwith the new database ID. - Run the following db migration to initialize the database (notice the
migrationsdirectory in this project):npx wrangler d1 migrations apply --remote rapid-darkness-e8b8-d1
- Create a kv namespace with a binding named "AUTH_STORAGE":
...and update the
npx wrangler kv namespace create AUTH_STORAGE
kv_namespaces->idfield inwrangler.jsonwith the new namespace ID. - Deploy the project!
npx wrangler deploy