'Restsharp returns 403 while Postman returns 200

This is the (modified) snippet that Postman gives for successful call to my page.

var client = new RestClient("http://sub.example.com/wp-json/wp/v2/users/me");
var request = new RestRequest(Method.GET);
request.AddHeader("authorization", "Basic anVyYTp3MmZacmo2eGtBOHJsRWrt");
IRestResponse response = client.Execute(request);

But when placed in my c# app it returns 403 forbidden, while Postman makes it and recieves 200. The same thing happens when I use httpclient in my app (403).



Solution 1:[1]

[Solution] Use the below line for the header

Headers.Add("User-Agent: Other");

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Thilina Chamika