Nov 12, 2020
Project Zero: 10yo's Missing Day (30 min)
elite forged download
Eroge Emulator Need help to find this gem. The game is called Koe no Mori.
Jan 15, 2020
Project:Zero - 20K's zero day. Game info: Project:Zero:20K's Zero Day - The Game [v1.0] [EPUB].rar, 10.00 MB
References
External links
Category:Pseudo-anonymity
Category:Video game cheatingQ:
How to run HttpClient.GetAsync with Credentials?
I have a service with a method that returns a JsonResult:
public JsonResult UserProfile(string token)
{
// Custom code
// return the profile
}
I would like to call this method from another service, with the same user token, like this:
public IActionResult Edit()
{
string token = "12345";
var result = UserService.UserProfile(token);
if (result.Status == 200)
{
var userProfile = JsonConvert.DeserializeObject(result.Data);
return Json(userProfile);
}
return NotFound();
}
The problem is that when I call UserService.UserProfile(token) it hits the database and retrieves the information.
I want the application to keep the user logged in and not to hit the database.
How can I modify this code?
A:
CredentialCache is for client credential but you want to use the same token for server as well.
var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var result = client.GetAsync("");
For server, you can use the AuthenticationManager.
var authManager = new AuthenticationManager();
authManager.Login(
new UserCredentials("username", "password")
);
// Bearer authentication
var bearer = authManager.GetExternalCredential("Bearer ac619d1d87
Related links:
Comments