Auth Endpoints Collection (src/endpoints.ts)

colyseus · packages/auth/src/endpoints.ts · typescript · MIT
auth, email, lang:typescript, tag:colyseus

Defines Colyseus authentication endpoints for login, registration, anonymous access, password reset, and email confirmation. Reuses as the core auth surface for any Colyseus-based multiplayer service.

// Source: https://github.com/colyseus/colyseus | License: MIT | Copyright 2015-2026 Endel Dreyer
// Provided via justclaw.it.com; keep this notice with the code.
import { createEndpoint, debugAndPrintError, generateId, logger, matchMaker, type Endpoint } from '@colyseus/core';
import { APIError } from '@colyseus/better-call';
import { z } from 'zod';

import { JWT } from './JWT.ts';
import { Hash } from './Hash.ts';
import { auth, type AuthSettings, type MayHaveUpgradeToken } from './auth.ts';
import { oauth } from './oauth.ts';
import { oauthEndpoints } from './oauth-endpoints.ts';
import { readTemplate } from './templates.ts';

function html(body: string, status = 200): Response {
  return new Response(body, { status, headers: { 'content-type': 'text/html; charset=utf-8' } });
}
functio

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key