# OAuth Invalid authorization code

**URL:** <https://discuss.dev.twitch.com/t/oauth-invalid-authorization-code/1947>\
**Category:** API\
**Created:** [March 30, 2015, 7:46pm UTC](https://discuss.dev.twitch.com/t/oauth-invalid-authorization-code/1947 "2015-03-30T19:46:03Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![DEfusion](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/defusion/32/412_2.png) [@DEfusion](https://discuss.dev.twitch.com/u/DEfusion)\
**Post date:** [March 30, 2015, 7:46pm UTC](https://discuss.dev.twitch.com/t/oauth-invalid-authorization-code/1947/1 "2015-03-30T19:46:03Z")

</div>

I have a user who is trying to login to my app via twitch and I keep getting a 400 “Invalid authorisation code” for his login attempts from twitch. I and other users can log out, sign up and log in. The user in question went in and disconnected the app via his connections but when trying again I get the same error.

Not sure why only 1 user is causing this error.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [March 31, 2015, 3:14pm UTC](https://discuss.dev.twitch.com/t/oauth-invalid-authorization-code/1947/2 "2015-03-31T15:14:18Z")

</div>

I can’t think of anything obvious without the keys to check.

If the user does not have a verified email address you might see some funkyness, but at about the time of your post Twitch was being odd, so it should be fine now I think!

---

<div class="post-metadata">

**Author:** ![DEfusion](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/defusion/32/412_2.png) [@DEfusion](https://discuss.dev.twitch.com/u/DEfusion)\
**Post date:** [March 31, 2015, 3:37pm UTC](https://discuss.dev.twitch.com/t/oauth-invalid-authorization-code/1947/3 "2015-03-31T15:37:01Z")

</div>

It seems it was related to some twitch funkyness at the time, the user in question has been able to authorize OK now. Thanks.

---

<div class="post-metadata">

**Author:** ![DEfusion](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/defusion/32/412_2.png) [@DEfusion](https://discuss.dev.twitch.com/u/DEfusion)\
**Post date:** [April 1, 2015, 3:53pm UTC](https://discuss.dev.twitch.com/t/oauth-invalid-authorization-code/1947/4 "2015-04-01T15:53:23Z")

</div>

@BarryCarlyon the user is reporting that they can’t log in again. This is the return link that they gave that produced the invalid authorisation code error [http://riustats.com/\_oauth/twitch?code=bw70knqbqrlymrnsu8123vo6web0ha&scope=user\_read&state=eyJsb2dpblN0eWxlIjoicG9wdXAiLCJjcmVkZW50aWFsVG9rZW4iOiItRnhfaG9mdzlVZU5GWFB0SFVENHdlWmo0R0NuY0tuX3A0dzFjcFdFMHNSIiwiaXNDb3Jkb3ZhIjpmYWxzZX0%3D](http://riustats.com/_oauth/twitch?code=bw70knqbqrlymrnsu8123vo6web0ha&scope=user_read&state=eyJsb2dpblN0eWxlIjoicG9wdXAiLCJjcmVkZW50aWFsVG9rZW4iOiItRnhfaG9mdzlVZU5GWFB0SFVENHdlWmo0R0NuY0tuX3A0dzFjcFdFMHNSIiwiaXNDb3Jkb3ZhIjpmYWxzZX0%3D)

---

<div class="post-metadata">

**Author:** ![AnacondaHL](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@AnacondaHL](https://discuss.dev.twitch.com/u/AnacondaHL)\
**Post date:** [April 1, 2015, 3:58pm UTC](https://discuss.dev.twitch.com/t/oauth-invalid-authorization-code/1947/5 "2015-04-01T15:58:06Z")

</div>

Hello I am the user in question. While it did work yesterday, today I am getting the same symptoms as before.

- I click Sign in with Twitch
- I get an empty pop up box with a huge url (I can provide an example if needed) that changes each time I try
- Nothing happens, or I get an “Internal Server Error” message after manually closing the popup box

Running on latest Firefox

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [April 1, 2015, 6:44pm UTC](https://discuss.dev.twitch.com/t/oauth-invalid-authorization-code/1947/6 "2015-04-01T18:44:12Z")

</div>

> [@AnacondaHL](#):
>
> “Internal Server Error”

that sounds like a problem on DEfusions side

---

<div class="post-metadata">

**Author:** ![DEfusion](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/defusion/32/412_2.png) [@DEfusion](https://discuss.dev.twitch.com/u/DEfusion)\
**Post date:** [April 1, 2015, 10:54pm UTC](https://discuss.dev.twitch.com/t/oauth-invalid-authorization-code/1947/7 "2015-04-01T22:54:47Z")

</div>

@BarryCarlyon the internal server error that he’s getting on my side is just that that what I’m using for the twitch auth isn’t handling the error from twitch properly I think.

This is the error I’m seeing in my logs when AnacondaHL tries to log in, he’s the only user I’ve seen having this issue.

```
"message":"Error in OAuth Server: Failed to complete OAuth handshake with Twitch. failed [400] {\"error\":\"Bad Request\",\"status\":400,\"message\":\"Invalid authorization code\"}","time":{"$date":1427905958968}
```

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [April 2, 2015, 8:57am UTC](https://discuss.dev.twitch.com/t/oauth-invalid-authorization-code/1947/8 "2015-04-02T08:57:08Z")

</div>

Next step is to get AnacondaHL to remove your application in the applications list. Logout of Twitch and then retry.

There is nothing 100% clear to the issue. Unless (and I only suggest this as it was the problem before), unless, AnacondaHL has malware on his machine (which sounds ridiculous but solved a login issue someone else was having with me before)

---

<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:** [May 2, 2015, 8:57am UTC](https://discuss.dev.twitch.com/t/oauth-invalid-authorization-code/1947/9 "2015-05-02T08:57:24Z")

</div>

Closed on May 2, 2015, 8:57am UTC

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