Skip to content

Commit 03e7133

Browse files
Allow using AUTHPROTO_EXTERNAL_DOMAIN to override oauth redirect
1 parent 2e1dc6e commit 03e7133

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

.changeset/moody-lemons-bake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@fujocoded/authproto": patch
3+
---
4+
5+
Allow using AUTHPROTO_EXTERNAL_DOMAIN to override oauth redirect

astro-authproto/src/lib/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const createClient = async (domain: string) => {
7878
};
7979

8080
const DOMAIN =
81-
externalDomain ?? process.env.EXTERNAL_DOMAIN ?? "http://127.0.0.1:4321/";
81+
process.env.AUTHPROTO_EXTERNAL_DOMAIN ?? externalDomain ?? "http://127.0.0.1:4321/";
8282
export const oauthClient = await createClient(DOMAIN);
8383

8484
const IDENTITY_RESOLVER = new DidResolver({});

astro-authproto/src/lib/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export const getConfig = ({ options, isDev }: { options: ConfigOptions, isDev: b
7676
options: undefined,
7777
};
7878

79-
const externalDomain = options.externalDomain ?? (isDev ? "http://127.0.0.1:4321/" : undefined);
79+
const externalDomain = options.externalDomain ?? (isDev ? "http://127.0.0.1:4321/" : options.applicationDomain);
8080

8181
const scopes: OAuthScope[] = ["atproto"];
8282
if (Array.isArray(options.scopes)) {

0 commit comments

Comments
 (0)