Cloudflare Workers

Talon Auth works in Cloudflare Workers. Workers use the standard Web platform Request/Response API and export a fetch handler — the same interface as a browser service worker.

Setup

Install the package:

npm install talon-auth

Create a verifier with your app ID from the Talon dashboard:

import { createVerifier } from 'talon-auth'

const verifier = createVerifier({ appId: '[your-app-id]' })

Verifying requests

Call verifier.verifyHeader() with the value of the Authorization header. Use req.headers.get('authorization') to read it from the Web-standard Headers object:

const { user } = await verifier.verifyHeader(req.headers.get('authorization')!)

Example

The example below exports a fetch handler that Cloudflare Workers invokes for every request. The index route serves an HTML page with the <talon-login> component, and the /message route verifies the JWT and returns a greeting.

cloudflare.ts
Subscribe to our NewsletterGet new Feathers content as it becomes available.
Talon Auth logo

Copyright © 2012 - 2026 feathers.dev