Skip to content

Commit c353739

Browse files
authored
Merge pull request #644 from mnfst/claude/fix-auth-origin-error-ADLwQ
Fix INVALID_ORIGIN error by auto-adding BETTER_AUTH_URL to trusted origins
2 parents 15af8e7 + 04fca2c commit c353739

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"manifest": patch
3+
---
4+
5+
Fix INVALID_ORIGIN error by automatically adding BETTER_AUTH_URL to trusted origins

packages/manifest/backend/src/auth/auth.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ import Database from 'better-sqlite3';
99
function getTrustedOrigins(): string[] {
1010
const origins: string[] = [];
1111

12+
// Add BETTER_AUTH_URL to trusted origins (the app's own URL should always be trusted)
13+
if (process.env.BETTER_AUTH_URL) {
14+
// Remove trailing slash if present for consistency
15+
origins.push(process.env.BETTER_AUTH_URL.replace(/\/$/, ''));
16+
}
17+
1218
// Add origins from ALLOWED_ORIGINS env var
1319
if (process.env.ALLOWED_ORIGINS) {
1420
origins.push(...process.env.ALLOWED_ORIGINS.split(',').map((o) => o.trim()));

0 commit comments

Comments
 (0)