completionId: cgen-6c55fd348e1e48bb90ebc41b37266e39
cgen-6c55fd348e1e48bb90ebc41b37266e39
This commit is contained in:
parent
982bc98155
commit
518b59ce7e
1 changed files with 14 additions and 0 deletions
|
|
@ -35,6 +35,20 @@ export default async function handler(req: any, res: any) {
|
||||||
return res.redirect("/login?error=no_code");
|
return res.redirect("/login?error=no_code");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse state to determine if this is a linking or login flow
|
||||||
|
let isLinkingFlow = false;
|
||||||
|
let redirectTo = "/dashboard";
|
||||||
|
|
||||||
|
if (state) {
|
||||||
|
try {
|
||||||
|
const stateData = JSON.parse(decodeURIComponent(state as string));
|
||||||
|
isLinkingFlow = stateData.action === "link";
|
||||||
|
redirectTo = stateData.redirectTo || redirectTo;
|
||||||
|
} catch (e) {
|
||||||
|
console.log("[Discord OAuth] Could not parse state:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const clientId = process.env.DISCORD_CLIENT_ID;
|
const clientId = process.env.DISCORD_CLIENT_ID;
|
||||||
const clientSecret = process.env.DISCORD_CLIENT_SECRET;
|
const clientSecret = process.env.DISCORD_CLIENT_SECRET;
|
||||||
const supabaseUrl = process.env.VITE_SUPABASE_URL;
|
const supabaseUrl = process.env.VITE_SUPABASE_URL;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue