I finally managed to recieve a valid (302) response from a RestRequest pasted below, but I don't know why.
Its all about the line with the "Autorisation" and the given Hash:
request.AddHeader("Authorization", "Basic xhr5n6xf_Rtguwv_jzr1d3_LTshikn4_0dtesdahNvp1:Kqf2Hs#Wwazl");
This line I found in the Internet (including the given Hash) and when I change the Hash or just omitt the line completly, the response turns to a 400 as it was on about 20 other code examples I've tried so far.
Can anybody explain what is going on here? I would like to omitt the "Authorisation" line including the Hash if possible.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
string url = "https://myurl/oauth2/login?response_type=token";
var client = new RestClient(url);
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Basic xhr5n6xf_Rtguwv_jzr1d3_LTshikn4_0dtesdahNvp1:Kqf2Hs#Wwazl");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", "client_id=XXXX&username=YYYY&password=ZZZZ&redirect_uri=", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);