Talon Auth works with Deno's built-in HTTP server. Deno uses the standard Web platform Request/Response API and imports npm packages via the npm: specifier — no install step required.
No install needed. Import talon-auth directly using the npm: prefix:
import { createVerifier } from 'npm:talon-auth'
Create a verifier with your app ID from the Talon dashboard:
const verifier = createVerifier({ appId: '[your-app-id]' })
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')!)
The example below uses Deno.serve to handle requests. The index route serves an HTML page with the <talon-login> component, and the /message route verifies the JWT and returns a greeting.