I am developing a RESTFUL API using django-rest-framework. And for Authorization I choose to use Token Authorization (not JWT). Below is what I tried:
Using POSTMAN (Works)
headers:
Authorization: Token 329367424fd30a876ccff05dbc5a18d86fe7158c
Using C# Client (no working)
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Token 329367424fd30a876ccff05dbc5a18d86fe7158c");
await client.GetAsync(<url>)
// Authentication credentials were not provided.
After I debug and override TokenAuthentication function, I realize that Authorization headers is being removed if requested from C# Client.
EDIT:
Actually I have tried using Javascript and it works also, I think the problem is C# HttpClient.
I tried
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization3", $"token {token}");
client.DefaultRequestHeaders.Add("Authorization", $"token {token}");
and I debug Authorization function in python, and I found out only Authorization3 was send to the server and Authorization wasn't
