SvelteKit
GitHub

Authentication Examples

Explore two different authentication methods using Cloudflare Workers and SvelteKit

Header Authentication

Header-based

Use the X-Custom-PSK header with a pre-shared key for authentication.

Example Request
curl -H "X-Custom-PSK: $HEADER_AUTH_VALUE" \
     http://localhost:5173/api/protected

Basic Authentication

HTTP Basic

Use standard HTTP Basic Authentication with username and password.

Example Request
curl -u $BASIC_AUTH_USERNAME:$BASIC_AUTH_PASSWORD \
     http://localhost:5173/api/protected

Authentication Response

Loading...