-1

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);
Frank W
  • 1
  • 1
  • I am not sure I understand. Why are you surprised that it does work? – mjwills Jan 03 '19 at 11:30
  • 1
    Because I'm using an AUTHORISATION Header and Hash I found in the Internet and can't find any other Info about the Hash - When I change the Hash it doesn't work anymore. I would like to understand why THIS Hash works – Frank W Jan 03 '19 at 11:33
  • Can you be super explicit about what you mean by `the hash`? – mjwills Jan 03 '19 at 11:36
  • What authentication is your server configured to accept? – spodger Jan 03 '19 at 12:19
  • Thanks everybody for your questions to help clarify my question.Unfortunately today my request that had been working yesterday is not working anymore today and I am unable to reach the administrator of the server. So let me close this question and wait for an answer of the server admin - thanks a lot for your efforts – Frank W Jan 04 '19 at 14:10
  • @ mjwills: thios is what i ment when speeking of the hash: "Basic xhr5n6xf_Rtguwv_jzr1d3_LTshikn4_0dtesdahNvp1:Kqf2Hs#Wwazl" – Frank W Jan 04 '19 at 14:13

1 Answers1

0

Unfortunately today I cannot reproduce the successful request from yesterday anymore and I am having problems getting in touch with the server admin. So thanks to all for your efforts to help answer my question. It seems the best to be patient and wait for an answer from the server admin, so I would like to close this question.

Frank W
  • 1
  • 1