i want to add token to header for webapi request.
how can i do this ?
this is my sample code
public IHttpActionResult Authenticate(Login data)
{
var Token = "fdsf123546fskjhf-gsuyuhsh";
//here add these token to header
return ?
}
thank you.
This code working me
public IHttpActionResult Authenticate(Login data)
{
Status = "success";
Message = "You have been Authenticated successfully";
var Token = "fdsf123546fskjhf-gsuyuhsh";
var Result = new { Status = Status, Message = Message };
var Response = Request.CreateResponse(HttpStatusCode.OK, Result);
Response.Headers.Add("AccessToken", Token.AccessToken);
return ResponseMessage(Response);
}