I need to set the auth header for my http web request using the AuthenticationResult I get from AuthenticationContext:
AuthenticationContext authContext = new AuthenticationContext("http://blabla/token");
Task<AuthenticationResult> resultTask = authContext.AcquireTokenAsync(
"http://blabla/service",
"SomeGuid",
new Uri("http://authlogin"),
new Microsoft.IdentityModel.Clients.ActiveDirectory.PlatformParameters(PromptBehavior.Auto, false));
resultTask.Wait();
AuthenticationResult result = resultTask.Result;
HttpWebRequest request = WebRequest.CreateHttp("http://MyApi/method");
//Set headers for request
I need to pass the authentication result to the header of my request. I know I can do
request.Headers[HttpRequestHeader.Authorization] = //something
I just don't know what that something should be. Any help is appreciated. Thanks
Aucun commentaire:
Enregistrer un commentaire