Loading
Are you having trouble using the Twitch app? Several users have reported the error ‘400’ that prevents them from using Twitch.
Tech Support 24/7
Ask a Tech Specialist Online
Connect with the Expert via email, text or phone. Include photos, documents, and more. Get step-by-step instructions from verified Tech Support Specialists.
On this page, you will find more information about the most common causes and most relevant solutions for the Twitch error ‘400’. Do you need help straight away? Visit our support page.
Error information
How to solve Twitch error 400
We’ve created a list of solutions which you can follow if you want to solve this Twitch problem yourself. Do you need more help? Visit our support page if you need professional support with Twitch right away.
Tech Support 24/7
Ask a Tech Specialist Online
Connect with the Expert via email, text or phone. Include photos, documents, and more. Get step-by-step instructions from verified Tech Support Specialists.
Check the server status of Twitch
Before you restart everything, check the server status of Twitch first. It may well be that Twitch is struggling with a temporary outage.
Check the status of Twitch
Have you found a solution yourself, but it is not in the list? Share your solution in the comments below.
Need more help?
Do you need more help?
Tech experts are ready to answer your questions.
Ask a question
This code doesn’t look right to me:
string postData = "client_id=" + clientID +
"&client_secret=" + clientSecret +
"&grant_type=authorization_code" +
"&redirect_uri=http://localhost" +
"&code=" + code +
"&state=TWStreamingStateAuthenticated";
ASCIIEncoding encoding = new ASCIIEncoding();
postData = HttpUtility.UrlEncode(postData);
byte[] byteArray = encoding.GetBytes(postData);
// ...
You are URL-encoding the entire post-data string. This has the effect of converting the &
and =
signs in the post data to %26
and %3d
respectively. When the remote server receives this data, it will scan through it looking for the &
and =
signs in order to separate out the parameter names and values. Of course, it won’t find any, so it will assume you have one big parameter name with no value. The server is probably expecting values for each of the six parameters you are attempting to send, but seeing values for none of them, and this may be why you are getting a 400 Bad Request error.
Instead of URL-encoding the whole string, URL-encode parameter values that may contain characters other than letters and numbers. I would try the following instead:
string postData = "client_id=" + HttpUtility.UrlEncode(clientID) +
"&client_secret=" + HttpUtility.UrlEncode(clientSecret) +
"&grant_type=authorization_code" +
"&redirect_uri=" + HttpUtility.UrlEncode("http://localhost") +
"&code=" + HttpUtility.UrlEncode(code) +
"&state=TWStreamingStateAuthenticated";
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] byteArray = encoding.GetBytes(postData);
// ...
This way, the remote server will still see the &
and =
characters, and so will be able to pull out the parameter names and values. Because we’ve URL-encoded the client ID, client secret, URL and code, any characters they contain that may have meaning in a URL will not have that meaning and will be received by the remote server as intended.
Also, if you are still getting a 400 Bad Request error response, try reading the contents of the response stream, obtained by calling GetResponseStream()
on the response. Often that will contain a message that will help you figure out what’s gone wrong.
Having had a closer look at your code, it seems you have a misunderstanding about how OAuth authentication works. Your getDownload_String
method will not get the access code you want, it will only get the HTML text of a Twitch login page.
This is how OAuth authentication works:
- Your app sends the user to a login URL, to allow the user to log in to Twitch.
- In the web browser, the user then enters their login credentials and submits the page to Twitch.
- The Twitch API then responds by redirecting the user’s web browser to the redirect URL, with a code appended. Your web app then reads this code out of the URL.
If your code is in a web app it will be able to respond to the URL redirected to in step 3. Alternatively, you may be able to use a WebBrowser control (Windows Forms, WPF) to handle the Twitch login, and handle a Navigating
event. If the URL being navigated to begins with the redirect URL, grab the code out of the URL, cancel the navigation and hide the login web-browser control.
The presence of what appears to be a RichTextBox control, along with your comment about your code being a ‘small C# application’, makes me think that your code is a Windows Forms or WPF application. If this is the case, then you will need to either:
- use a WebBrowser control as I described above,
- replace your WinForms/WPF app with a web app, or
- get in contact with Twitch to request the use of the password flow (which appears not to require a redirect), and use that instead.
Ошибка 400 свидетельствует о том, что браузер пользователя отправил некорректный запрос на сервер, на
котором расположен требуемый сайт.
О чем свидетельствует «ошибка 400»
Почти всегда проблема находится на стороне пользователя, свидетельствуя о проблемах с системой на его
компьютере. Чаще всего причина в неправильных настройках браузера, а также в NET Framework, сервисе,
входящем Windows. Так что данная ошибка свидетельствует о том, что пользователю нужно обратить внимание
на состояние своей системы.
Что делать пользователю, когда в браузере появляется код ошибки 400
Если вы регулярно видите такую ошибку, являясь владельцем сайта, попробуйте совершить вход с другого
устройства. Если при этом снова возникнет ошибка 400, проблему следует искать на стороне хостинга. В
остальных случаях она на стороне устройства, посылающего запрос. Если проблема с браузером, необходимо
очистить кэш и файлы cookies, переустановить браузер. Для контроля также попробуйте открыть сайт другим
браузером, если сервер не возвратит ошибку 400, значит, ваша проблема именно в конкретном браузере.
Причины возникновения ошибки «ERROR 400 BAD REQUEST»
Возможный перечень причин весьма широк. Это может быть также воздействие компьютерных вирусов, поэтому
важно выполнить проверку на вирусы и вылечить все обнаруженные проблемы. Антивирусы также могут
приводить к возникновению ошибки 400, поэтому для проверки стоит на время отключить активный антивирус.
Также стоит отключить активный брандмауэр. Еще одна причина — Windows. Очистите систему, обновите все
драйверы и просканируйте систему. В самых сложных случаях может понадобиться переустановка Windows.
Не исключается также и проблема со стороны вашего провайдера услуг интернет. Если все проверки —
браузер, система, антивирус — не дали результата, обратитесь в службу технической поддержки
пользователей за разъяснением.
Вас также может заинтересовать
Twitch is a great platform for sharing your gaming experience with other passionate players. However, streaming your games on Twitch may sometimes fail due to bad request errors.
The complete error message that appears on the screen is this: {“error”:”Bad Request”,”status”:400,”message”:null}”
Don’t panic, we’re here to help. We noticed this issue is quite common among PS4 gamers, so we decided to create this guide and list all the solutions that you can use to fix Twitch bad request 400 errors.
Fix Twitch Bad Request on PS4
As always, before trying to fix this problem, you should check the Twitch Service Status. If their login servers are experiencing issues, all you can do is wait patiently for Twitch to solve the problem.
If there are no known issues on the list, you can go ahead and use the solutions available below.
- Fix 1 – Set date and time using Internet
Incorrect date and time information often triggers bad request errors on Twitch. Make sure that your date and time information is indeed accurate.
Go to Settings > Date and Time> Set Using Internet
That should fix the problem for most users.
⇒ Here’s a Handy Guide: How to Change Twitch Display Name | Step-by-Step Guide
- Fix 2 – Update your console
Updating your PS4 is as critical as breathing is to humans. Make sure that you’re running the latest system firmware version on your device.
- Fix 3 – Sign out of your account
If the problem persists and you still can’t stream gaming video content to Twitch, try logging out of your PlayStation and Twitch accounts. Then turn off your console and wait for a couple of minutes.
Power up your PS4 and log back in. Wait again for one minute. Then log in to Twitch and start your streaming session.
So, there you have three quick workarounds to fix Twitch bad request errors on PS4. We hope something helps.
⇒ Read Next: How to Blacklist Words in Twitch Chat
Article summary
→ Error: Twitch bad request
→ Fixes: Set date and time using Internet, update your console, sign out of your account