refactoring

This commit is contained in:
Paul Schneider 2025-02-14 00:20:35 +00:00
commit 8e8f4d3896
367 changed files with 217 additions and 364 deletions

View file

@ -44,7 +44,7 @@ namespace testOauthClient.Controllers
var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
var content = await client.GetStringAsync("https://localhost:5001/api/account/me");
var content = await client.GetStringAsync("https://localhost:6001/api/account/me");
ViewBag.Json = content;
return View("json");
@ -53,10 +53,11 @@ namespace testOauthClient.Controllers
[HttpPost]
public async Task<IActionResult> GetUserInfo(CancellationToken cancellationToken)
{
var accessToken = await HttpContext.GetTokenAsync("access_token");
var client = new HttpClient(new HttpClientHandler(){ AllowAutoRedirect=false });
client.DefaultRequestHeaders.Add("Accept", "application/json");
client.SetBearerToken(accessToken);
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
var content = await client.GetAsync("https://localhost:6001/api/account/me");
content.EnsureSuccessStatusCode();
var json = await content.Content.ReadAsStreamAsync();