Equivalent of calling ".auth/refresh" endpoint through jQuery for C#

33 Views Asked by At

Following this page, when we are using Azure Easy Auth, we can call ".auth/refresh" endpoint from jQuery in a very simple way:

$.ajax("/.auth/refresh").done(function() {
  console.log("Token refresh completed successfully.");
})

When we reload the page, the access token in the headers will contain an updated expiration date:

enter image description here

My question is, how can we do this from C#? I tried calling the refresh GET endpoint by using HttpClient and leaving the headers blank, this didn't work. Then I tried putting the refresh token in the header as bearer and turning it into a POST request like some sources online stated. This all yielded the same 401 responses.

Is there a simpler way of doing this? This seems anything but "Easy".

EDIT: Forgot to mention that I already configured Refresh Tokens on the App Service by following the guide further up in that link I provided. I get it in the headers.

0

There are 0 best solutions below