That's my YARP configuration:
builder.Services.AddReverseProxy() .LoadFromConfig(builder.Configuration.GetRequiredSection("ReverseProxy")) .AddTransforms(builder => { builder.AddRequestTransform(async (ctx) => { var accessToken = await ctx.HttpContext.GetTokenAsync("access_token"); ctx.ProxyRequest.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); }); });
and the problem is I want to refresh my access token when the response for proxied request is 401. Specifically, I want to get new access token using refresh token, set new cookie with new access token and retry request. But I can't find any documented way to do so if I'm using YARP.