webauthn-example
webauthn-example copied to clipboard
Example project for password-less login through WebAuthn in Cloudflare Workers and Deno.
Workers WebAuthn Example
Example project for passwordless login through WebAuthn in Worker Runtimes built with Worker Tools
Usage
Deno
Requires Deno 1.22 or higher.
deno task serve
This will store sessions and users in a SQLite file at the root.
Cloudflare Workers
If you have Miniflare installed, just run
miniflare
If you have wrangler 2 or later installed, run
wrangler dev --local
For running on CF Workers proper,
get your CF account_id from the workers dashboard and overwrite in wrangler.toml.
Create a new KV namespace on the workers dashboard and overwrite id and preview_id:
account_id = '...'
kv_namespaces = [
{ binding = "KV_STORAGE", id = "...", preview_id = "..." }
]
Then run
wrangler dev
If you want to run on a other port than 8787, update WORKER_LOCATION in wrangler.toml, otherwise WebAuthn calls will fail.