isSameSite (src/url.ts)

ory/elements · packages/ssr/src/url.ts · typescript · Apache-2.0
integration

Compare web origins and extract request origins for security.

// Source: https://github.com/ory/elements | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0

import { get } from "psl"

import type { OryRequest } from "./types"

/**
 * Two origins are the same site when their hostnames are equal or share the
 * same registrable domain (eTLD+1). Cookies scoped to the registrable domain
 * are visible to both, so the app can talk to Ory directly without proxying.
 *
 * @param originA - The first origin or URL.
 * @param originB - The second origin or URL.
 * @returns Whether both are on the same site.
 * @public
 */
export function isSameSite(originA: string, originB: string): bool

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

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

Get a free API key