# Twitch Oauth success redirect "404 page not found"

**URL:** <https://discuss.dev.twitch.com/t/twitch-oauth-success-redirect-404-page-not-found/36163>\
**Category:** API\
**Created:** [January 13, 2022, 11:22am UTC](https://discuss.dev.twitch.com/t/twitch-oauth-success-redirect-404-page-not-found/36163 "2022-01-13T11:22:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![framedropco](https://avatars.discourse-cdn.com/v4/letter/f/3bc359/32.png) [@framedropco](https://discuss.dev.twitch.com/u/framedropco)\
**Post date:** [January 13, 2022, 11:22am UTC](https://discuss.dev.twitch.com/t/twitch-oauth-success-redirect-404-page-not-found/36163/1 "2022-01-13T11:22:04Z")

</div>

After a successful Oauth flow, Twitch seems to be redirecting to [https://id.twitch.tv](https://id.twitch.tv) (no extra path or query params) and not the root path of my app as it should.

![image](https://d2opxh93rbxzdn.cloudfront.net/original/3X/e/5/e5198002d2ce6f75ba4d89a9a6e36749b8e7f742.png)

This happens only on 2 of the 3 sign in buttons. One of them redirects ok.

After a few hours of debugging, I can’t find why 2 out of the 3 buttons are triggering this failed redirect, since they generate exactly the same Oauth URL:

`https://id.twitch.tv/oauth2/authorize?client_id=<hidden>&redirect_uri=https%3A%2F%2Fwww.framedrop.co%2Fusers%2Fauth%2Ftwitch%2Fcallback&response_type=code&scope=user%3Aread%3Aemail&state=<hidden>`

Does anyone have an idea of where to look to track this bug?

Thanks!

---

<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:** [January 13, 2022, 12:21pm UTC](https://discuss.dev.twitch.com/t/twitch-oauth-success-redirect-404-page-not-found/36163/2 "2022-01-13T12:21:53Z")

</div>

> [@framedropco](#):
>
> `client_id=<hidden>`

ClientID’s are public no need to censore them

> [@framedropco](#):
>
> I can’t find why 2 out of the 3 buttons are triggering this failed redirect, since they generate exactly the same Oauth URL:

> [@framedropco](#):
>
> https%3A%2F%[2Fwww.framedrop.co](http://2Fwww.framedrop.co)%2Fusers%2Fauth%2Ftwitch%2Fcallback

Would suggest that your callback is redirecting back to id.twitch.

Check your access log or chrome network tools (preserve log)

And follow the flow.

It’s 99% likely to be something your side/in your implementation

---

<div class="post-metadata">

**Author:** ![framedropco](https://avatars.discourse-cdn.com/v4/letter/f/3bc359/32.png) [@framedropco](https://discuss.dev.twitch.com/u/framedropco)\
**Post date:** [January 13, 2022, 12:28pm UTC](https://discuss.dev.twitch.com/t/twitch-oauth-success-redirect-404-page-not-found/36163/3 "2022-01-13T12:28:24Z")

</div>

Thanks @BarryCarlyon. Yeah I figured the issue would be on my side for sure.

Think I tracked it down - apparently some confusion with the ORIGIN header and the ruby omniauth library. I was getting a Twitch URL in the wrong place.

Solved, thanks!

---

<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 12, 2022, 12:29pm UTC](https://discuss.dev.twitch.com/t/twitch-oauth-success-redirect-404-page-not-found/36163/4 "2022-02-12T12:29:21Z")

</div>

Closed on February 12, 2022, 12:29pm UTC

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