Skip to content

Commit 4e65402

Browse files
committed
fix(auth): route Google OAuth callback through authorized redirect URI and skip cross-subdomain state cookie check
1 parent bfd748a commit 4e65402

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎apps/site/src/lib/auth.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ function resolveSocialProviders() {
139139
providers.google = {
140140
clientId: googleClientId,
141141
clientSecret: googleClientSecret,
142+
redirectURI:
143+
workerEnv.GOOGLE_OAUTH_REDIRECT_URI ||
144+
process.env.GOOGLE_OAUTH_REDIRECT_URI ||
145+
"https://postiz.codingcat.dev/integrations/social/youtube",
142146
prompt: "select_account",
143147
};
144148
}
@@ -320,9 +324,13 @@ export function getPortalAuth(origin: string, d1?: D1Database) {
320324
trustedOrigins: [
321325
"https://codingcat.dev",
322326
"https://dev.codingcat.dev",
327+
"https://postiz.codingcat.dev",
323328
origin,
324329
],
325330
...(db ? { database: db } : {}),
331+
account: {
332+
skipStateCookieCheck: true,
333+
},
326334
socialProviders: resolveSocialProviders(),
327335
plugins: buildAuthPlugins(origin),
328336
});

0 commit comments

Comments
 (0)