Files
zerobyte/app/server/lib/auth/base-url.ts
Nico 2ff6451f37 test: use better-auth built-in test plugin (#599)
test: use better-auth built-in test plugin

refactor: map auth errors server side

refactor: native trusted providers callback usage

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

## Release Notes

* **New Features**
  * Enhanced SSO authentication error messaging with specific guidance for different failure scenarios (account linking required, email verification needed, banned accounts, invite-only access).

* **Chores**
  * Updated authentication dependencies to version 1.5.0.

* **Tests**
  * Extended test coverage for SSO error code handling and authentication scenarios.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-03-01 15:10:50 +01:00

23 lines
445 B
TypeScript

type AllowedHostsResult = {
allowedHosts: string[];
invalidOrigins: string[];
};
export function buildAllowedHosts(origins: string[]): AllowedHostsResult {
const validHosts = new Set<string>();
const invalidOrigins: string[] = [];
for (const origin of origins) {
try {
validHosts.add(new URL(origin).host);
} catch {
invalidOrigins.push(origin);
}
}
return {
allowedHosts: Array.from(validHosts),
invalidOrigins,
};
}