# 400: Bad Request

**URL:** <https://discuss.dev.twitch.com/t/400-bad-request/8771>\
**Category:** API\
**Created:** [January 7, 2017, 2:36pm UTC](https://discuss.dev.twitch.com/t/400-bad-request/8771 "2017-01-07T14:36:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TomiG](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@TomiG](https://discuss.dev.twitch.com/u/TomiG)\
**Post date:** [January 7, 2017, 2:36pm UTC](https://discuss.dev.twitch.com/t/400-bad-request/8771/1 "2017-01-07T14:36:01Z")

</div>

When trying to get the access token I’m always running into that Bad Request 400 error. I’m not really sure what the grant\_type is.

```
POST https://api.twitch.tv/kraken/oauth2/token

POST Body (URL-encoded)
client_id=<your client ID>
&client_secret=<your client secret>
&grant_type=authorization_code
&redirect_uri=<your registered redirect URI>
&code=<authorization code received above>

```

I do have the client id, the client secret, the redirect uri and the code. I tried using the code that I get from my redirect uri for the grant\_type but it always gives me the bad request error. I also tried the oauth key but it didnt work. I really dont know what key to use and I hope somone can help me out.

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![3ventic](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/3ventic/32/298_2.png) [@3ventic](https://discuss.dev.twitch.com/u/3ventic)\
**Post date:** [January 7, 2017, 4:14pm UTC](https://discuss.dev.twitch.com/t/400-bad-request/8771/2 "2017-01-07T16:14:21Z")

</div>

Grant type should be `token` for implicit or `code` for authorization grant flow

---

<div class="post-metadata">

**Author:** ![TomiG](https://avatars.discourse-cdn.com/v4/letter/t/aeb1de/32.png) [@TomiG](https://discuss.dev.twitch.com/u/TomiG)\
**Post date:** [January 7, 2017, 4:46pm UTC](https://discuss.dev.twitch.com/t/400-bad-request/8771/3 "2017-01-07T16:46:37Z")

</div>

I dont get it. I need a “authorization code” for grant type. Where do I find this code? Is it the code that I’m writing in here? `&code=<authorization code received above>`

---

<div class="post-metadata">

**Author:** ![Adrian\_Schofield](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/adrian_schofield/32/2340_2.png) [@Adrian\_Schofield](https://discuss.dev.twitch.com/u/Adrian_Schofield)\
**Post date:** [January 8, 2017, 8:56am UTC](https://discuss.dev.twitch.com/t/400-bad-request/8771/4 "2017-01-08T08:56:49Z")

</div>

You have the grant\_type correct for the authorization code flow. Could you share your code that you use to make the POST? There are lots of reasons why you might be getting a 400 returned.

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [February 7, 2017, 8:56am UTC](https://discuss.dev.twitch.com/t/400-bad-request/8771/5 "2017-02-07T08:56:49Z")

</div>

Closed on February 7, 2017, 8:56am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
