Skip to content

Commit eeff2b5

Browse files
committed
fix(pkce): read PUBLIC_GITHUB_CLIENT_ID from import.meta.env
1 parent 4ce0246 commit eeff2b5

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

app/src/lib/policies/github/oauthPkce.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { base } from '$app/paths';
22
import { browser, dev } from '$app/environment';
3-
import { env as publicEnv } from '$env/dynamic/public';
43
import { z } from 'zod';
54

65
const SESSION_PREFIX = 'github:oauth:pkce:';
@@ -22,7 +21,7 @@ function isGithubPagesHost() {
2221
}
2322

2423
function getOauthProxyUrl() {
25-
const raw = publicEnv.PUBLIC_GITHUB_OAUTH_PROXY_URL;
24+
const raw = import.meta.env.PUBLIC_GITHUB_OAUTH_PROXY_URL;
2625
if (!raw) return null;
2726
try {
2827
return new URL(raw).toString();
@@ -45,7 +44,7 @@ function normalizeRedirectUri(value: string) {
4544

4645
export function getGithubPkceAvailability(): GithubPkceAvailability {
4746
if (!browser) return { supported: false, reason: 'unsupportedRuntime' };
48-
const clientId = publicEnv.PUBLIC_GITHUB_CLIENT_ID;
47+
const clientId = import.meta.env.PUBLIC_GITHUB_CLIENT_ID;
4948
if (!clientId) return { supported: false, reason: 'missingClientId' };
5049
if (!globalThis.crypto?.subtle) return { supported: false, reason: 'unsupportedRuntime' };
5150

@@ -61,7 +60,7 @@ export function getGithubPkceAvailability(): GithubPkceAvailability {
6160

6261
export function getGithubManualTokenAllowed() {
6362
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
64-
return Boolean(dev) || Boolean(publicEnv.PUBLIC_GITHUB_ALLOW_MANUAL_TOKEN);
63+
return Boolean(dev) || Boolean(import.meta.env.PUBLIC_GITHUB_ALLOW_MANUAL_TOKEN);
6564
}
6665

6766
export type GithubPkceStartResult =

0 commit comments

Comments
 (0)