Skip to content

Commit a8ec775

Browse files
Added delay
1 parent ab561f2 commit a8ec775

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

backend/Program.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
options.Cookie.SecurePolicy = CookieSecurePolicy.Always; // HTTPS only (required for SameSite=None)
7979
options.Cookie.SameSite = SameSiteMode.None; // Required for cross-origin requests
8080
options.Cookie.IsEssential = true; // Mark as essential for GDPR compliance
81+
options.Cookie.Path = "/"; // Make cookie available to all paths
8182
options.ExpireTimeSpan = TimeSpan.FromHours(24);
8283
options.SlidingExpiration = true;
8384

@@ -289,8 +290,25 @@
289290
);
290291
}
291292

292-
// Redirect to frontend success page
293-
return Results.Redirect($"{frontendUrl}/auth/callback");
293+
// Return an HTML page that will handle the redirect and ensure cookie is set
294+
var html = $@"
295+
<!DOCTYPE html>
296+
<html>
297+
<head>
298+
<title>Authentication Successful</title>
299+
<script>
300+
// Give the browser a moment to set the cookie, then redirect
301+
setTimeout(function() {{
302+
window.location.href = '{frontendUrl}/auth/callback';
303+
}}, 100);
304+
</script>
305+
</head>
306+
<body>
307+
<p>Authentication successful! Redirecting...</p>
308+
</body>
309+
</html>";
310+
311+
return Results.Content(html, "text/html");
294312
})
295313
.WithTags("Authentication")
296314
.WithSummary("OAuth callback endpoint")

0 commit comments

Comments
 (0)