Quantcast
Channel: Active questions tagged retry-logic - Stack Overflow
Viewing all articles
Browse latest Browse all 950

How to refresh access token when proxied request gets 401 response YARP

$
0
0

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.


Viewing all articles
Browse latest Browse all 950

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>