更新时间:2023-09-08 10:43:52
显然我应该解释为什么这是答案.
Apparently I should provide an explanation of why this is the answer.
说明:这是为 Simple ODataClient 添加令牌的方式.
Explanation: this is how you add the token for Simple ODataClient.
var settings = new ODataClientSettings(new Uri("http://localhost:9000/"));
settings.BeforeRequest += delegate(HttpRequestMessage message)
{
message.Headers.Add("Authorization", "Bearer " + token.AccessToken);
};
var client = new ODataClient(settings);