From 5363c7697a0f4f5d4f66c76288b7838a8df9f3e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6nig?= Date: Mon, 1 Apr 2024 14:48:41 +0200 Subject: [PATCH] fix: github and google oauth --- src/auth/githubOAuth.ts | 4 ++-- src/auth/googleOAuth.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/auth/githubOAuth.ts b/src/auth/githubOAuth.ts index e17fa83..bc8a9b3 100644 --- a/src/auth/githubOAuth.ts +++ b/src/auth/githubOAuth.ts @@ -7,7 +7,7 @@ import { config } from '../utils/envManager'; const setupGitHubOAuth = (app: Express): void => { app.get('/auth/github', passport.authenticate('github')); app.get( - config.BACKEND_URL + '/auth/github/callback', + '/auth/github/callback', passport.authenticate('github', { failureRedirect: '/login' }), (req, res) => { res.redirect('/'); @@ -18,7 +18,7 @@ const setupGitHubOAuth = (app: Express): void => { { clientID: config.GITHUB_CLIENT_ID, clientSecret: config.GITHUB_CLIENT_SECRET, - callbackURL: '/auth/github/callback' + callbackURL: config.BACKEND_URL + '/auth/github/callback' }, async (accessToken, refreshToken, profile, cb) => { const email = profile.emails?.[0].value ?? ''; diff --git a/src/auth/googleOAuth.ts b/src/auth/googleOAuth.ts index ddfb65a..b032847 100644 --- a/src/auth/googleOAuth.ts +++ b/src/auth/googleOAuth.ts @@ -7,7 +7,7 @@ import { config } from '../utils/envManager'; const setupGoogleOAuth = (app: Express): void => { app.get('/auth/google', passport.authenticate('google')); app.get( - config.BACKEND_URL + '/auth/google/callback', + '/auth/google/callback', passport.authenticate('google', { failureRedirect: '/login' }), (req, res) => { res.redirect('/'); @@ -18,7 +18,7 @@ const setupGoogleOAuth = (app: Express): void => { { clientID: config.GOOGLE_CLIENT_ID, clientSecret: config.GOOGLE_CLIENT_SECRET, - callbackURL: '/auth/google/callback', + callbackURL: config.BACKEND_URL + '/auth/google/callback', scope: ['profile', 'email'] }, async (accessToken, refreshToken, profile, cb) => {