almost 4 years ago

最近於串接API,客戶對於將Token放在URL,透過 HttpGet這件事情很不解
故要改變一個方式將Token 儲存於 Head 的 Authorizaion

Head Authorization
 HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(apiUrl);
 req.Method = "POST";
 req.ContentType = "application/x-www-form-urlencoded";
 req.Headers.Add("Authorization", "Token " + _token);
 req.ContentLength = bs.Length;
中的 Authorization
if (Request.Headers.Authorization != null)
   token = Request.Headers.Authorization.ToString();

這樣做就可以將Token透過Head Authorization 的方式存取

← Windows XP IE8 跳出 OCget.dll 安全性 C# WEB API 取得Reqeust Body的設計 →
 
comments powered by Disqus