diff --git a/.env.example b/.env.example index 143a06fd9..85b197214 100644 --- a/.env.example +++ b/.env.example @@ -5,6 +5,5 @@ DATABASE_URL=postgresql://sendou@localhost:5432/sendou_ink?schema=public // you can get them by making an application on https://discord.com/developers DISCORD_CLIENT_ID= DISCORD_CLIENT_SECRET= -DISCORD_CALLBACK_URL=http://localhost:3000/auth/discord/callback COOKIE_SECRET= -FRONT_PAGE_URL=http://localhost:3000 +FRONT_PAGE_URL=http://localhost:3000/ diff --git a/server/auth.ts b/server/auth.ts index 882349196..8523efe50 100644 --- a/server/auth.ts +++ b/server/auth.ts @@ -21,10 +21,6 @@ export function setUpAuth(app: Express): void { process.env.DISCORD_CLIENT_SECRET, "env var DISCORD_CLIENT_SECRET undefined" ); - invariant( - process.env.DISCORD_CALLBACK_URL, - "env var DISCORD_CALLBACK_URL undefined" - ); invariant(process.env.COOKIE_SECRET, "env var COOKIE_SECRET undefined"); passport.use( @@ -32,7 +28,7 @@ export function setUpAuth(app: Express): void { { clientID: process.env.DISCORD_CLIENT_ID, clientSecret: process.env.DISCORD_CLIENT_SECRET, - callbackURL: process.env.DISCORD_CALLBACK_URL, + callbackURL: `${process.env.FRONT_PAGE_URL}auth/discord/callback`, scope: ["identify", "connections"], }, function (_accessToken, refreshToken, loggedInUser, cb) {