File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
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" )
You can’t perform that action at this time.
0 commit comments