我怎样才能从 web api 返回 token ,以便我可以在 javascript 中设置该 token 的 cookie? 这样我就生成了 token
[Route("api/agency/login")]
[HttpPost]
public HttpResponseMessage loginApi([FromBody] Users UserObj)
{
var tokanObj = method.AccessToken(UserObj.username, UserObj.Password, "password");
//How to return this token ??
}
最佳答案
你试过了吗StringContent ?
return new HttpResponseMessage( HttpStatusCode.OK )
{
Content = new StringContent( "Your token here" )
};
关于c# - 如何从 HttpresponseMessage Asp.net Web Api 返回不记名 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47130428/