fix: Remove explicit port 443 from OAuth redirect URIs for Cloudflare compatibility
All checks were successful
BCards Deployment Pipeline / Run Tests (push) Successful in 2s
BCards Deployment Pipeline / PR Validation (push) Has been skipped
BCards Deployment Pipeline / Build and Push Image (push) Successful in 15m30s
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (push) Successful in 2m1s
BCards Deployment Pipeline / Deploy to Test (x86 - Local) (push) Has been skipped
BCards Deployment Pipeline / Cleanup Old Resources (push) Has been skipped
BCards Deployment Pipeline / Deployment Summary (push) Successful in 0s

This fixes CORS errors when using Ajax requests after session timeout.
The issue was that redirect_uri included :443 port causing Cloudflare issues.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ricardo Carneiro 2025-09-18 14:04:28 -03:00
parent 3d2ce1f8cf
commit 1caac8d7fb

View File

@ -298,6 +298,16 @@ authBuilder.AddGoogle(options =>
options.Events = new OAuthEvents
{
OnRedirectToAuthorizationEndpoint = context =>
{
// Fix para Cloudflare - remover porta 443 explícita
if (!builder.Environment.IsDevelopment())
{
context.RedirectUri = context.RedirectUri.Replace(":443", "");
}
context.Response.Redirect(context.RedirectUri);
return Task.CompletedTask;
},
OnRemoteFailure = context =>
{
var logger = context.HttpContext.RequestServices.GetRequiredService<ILogger<Program>>();