The input is not a valid Base-64 string Error, My

2019-08-27 02:24发布

问题:

I am trying to send a JSON post, but my JSON seems to differ a little bit from what the site usually sends
Here is what i am sending:

{"CodeNumberTextBox":"","txusername":"yC6IBEbznlRlKOKv8zrhiA","txpass":"pAQAyrr5u9/hK35iTIlt7Q=="}

Here is what the website sends when you click login:

{ CodeNumberTextBox:'', txusername:'yC6IBEbznlRlKOKv8zrhiA', txpass:'pAQAyrr5u9/hK35iTIlt7Q==' }

Here is the error i get when i send my JSON:
'The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. '
I use the code below to create my JSON:

  jsonRawRequest := TJSONObject.Create;
  jsonObject.AddPair('CodeNumberTextBox', '');
  jsonObject.AddPair('txusername', 'yC6IBEbznlRlKOKv8zrhiA');
  jsonObject.AddPair('txpass', 'pAQAyrr5u9/hK35iTIlt7Q==');
  jsonRequest := TStringStream.Create(jsonRawRequest.ToString(), TEncoding.UTF8);

  idHttp.Request.ContentType := 'application/json';
  idHttp.Request.Referer := 'SomeURL';
  idHttp.Post(URL, jsonRequest, ms)