diff --git a/app/services/auth.server.ts b/app/services/auth.server.ts index 71cc2a0..c089c9b 100644 --- a/app/services/auth.server.ts +++ b/app/services/auth.server.ts @@ -17,10 +17,12 @@ export function getAuthenticator(env: Env) { } const sessionStorage = getSessionStorage(env.SESSION_SECRET); + const callbackURL = new URL(env.CF_PAGES_URL); + callbackURL.pathname = '/auth/callback'; authenticator = new Authenticator(sessionStorage); authenticator.use(new Auth0Strategy( { - callbackURL: env.AUTH0_CALLBACK_URL, + callbackURL: callbackURL.toString(), clientID: env.AUTH0_CLIENT_ID, clientSecret: env.AUTH0_CLIENT_SECRET, domain: env.AUTH0_DOMAIN, diff --git a/worker-configuration.d.ts b/worker-configuration.d.ts index 4f0da0f..806ad8f 100644 --- a/worker-configuration.d.ts +++ b/worker-configuration.d.ts @@ -1,11 +1,12 @@ // Generated by Wrangler by running `wrangler types` interface Env { - AUTH0_CALLBACK_URL: string; + AUTH0_DOMAIN: string; AUTH0_CLIENT_ID: string; AUTH0_CLIENT_SECRET: string; - AUTH0_DOMAIN: string; + AUTH0_CALLBACK_URL: string; AUTH0_LOGOUT_URL: string; AUTH0_RETURN_TO_URL: string; SESSION_SECRET: string; + CF_PAGES_URL: string; }