fix: use window.location.origin for Google callback URL and remove redundant whitespace in auth config
This commit is contained in:
@@ -23,7 +23,6 @@ export const auth = betterAuth({
|
|||||||
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
|
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
trustedOrigins: [
|
trustedOrigins: [
|
||||||
process.env.APP_BASE_URL ?? 'http://localhost:5173',
|
process.env.APP_BASE_URL ?? 'http://localhost:5173',
|
||||||
process.env.BETTER_AUTH_URL ?? 'http://localhost:3000',
|
process.env.BETTER_AUTH_URL ?? 'http://localhost:3000',
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export function LoginPage({ redirectTo = '/' }: LoginPageProps) {
|
|||||||
provider: 'google',
|
provider: 'google',
|
||||||
callbackURL: redirectTo.startsWith('http')
|
callbackURL: redirectTo.startsWith('http')
|
||||||
? redirectTo
|
? redirectTo
|
||||||
: `http://localhost:5173${redirectTo}`,
|
: `${window.location.origin}${redirectTo}`,
|
||||||
});
|
});
|
||||||
} catch {
|
} catch {
|
||||||
setSubmitError('No pudimos iniciar sesión con Google.');
|
setSubmitError('No pudimos iniciar sesión con Google.');
|
||||||
|
|||||||
Reference in New Issue
Block a user