这是我的GETRequest方法...
HttpClient client = new HttpClient();
var dashboardEndpoint = Helper.GetUsersurl;
client.DefaultRequestHeaders.Clear();
client.DefaultRequestHeaders.Add("Authorization", "Bearer"+Helper.userprofile.token);
var result = await client.GetStringAsync(dashboardEndpoint);
var UsersList = JsonConvert.DeserializeObject<AddedUsers>(result);
//Users = new ObservableCollection<AddedUsers>(UsersList);
Emplist.ItemsSource = UsersList.data;
}
我尝试了不同的方法,但是令牌未随请求一起发送,因此API向我抛出错误401。任何帮助将不胜感激,请...
答案 0 :(得分:0)
正如@jason所说,请尝试在 Bearer 和 Token
之间添加一个空格client.DefaultRequestHeaders.Add("Authorization", "Bearer " + Helper.userprofile.token);
答案 1 :(得分:0)
因此,我后来研究了模式以及对邮递员的响应,然后我意识到我应该只传递键和值。在这种情况下
from matplotlib import rc
matplotlib.rcParams['axes.grid'] = True
matplotlib.rcParams['savefig.transparent'] = True
我只需要将授权作为密钥,并将令牌作为值。谢谢大家