Talon Auth works with any Node.js HTTP server. This example uses the built-in node:http module to show the full flow with no framework dependencies.
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]' })
Call verifier.verifyHeader() with the Authorization header from the incoming request. It returns the verified user object on success, or throws if the token is missing or invalid:
const { user } = await verifier.verifyHeader(req.headers.authorization)
The example below serves an HTML page that loads the <talon-login> web component, authenticates the user in the browser, then calls a /message endpoint that verifies the JWT and returns a personalized greeting.