twitchdev / issues

Issue tracker for third party developers.
Apache License 2.0
73 stars 6 forks source link

oAuth bug causing "Invalid authorization code" issue #523

Open richardmtheobald opened 3 years ago

richardmtheobald commented 3 years ago

Brief description

How to reproduce The new oAuth process creates a page with a box that says "You are about to leave Twitch." and a Continue button. If you click the Continue button, oAuth fails.

Expected behavior

Screenshots

Additional context or questions

Syzuna commented 3 years ago

The issue seems to be a double redirect with the same code and state if you click the continue button.

if I had to guess the scheduled redirect by the auto redirect doesn't get cancelled properly somehow and that leads to this double redirect although its still weird that this happens.

I can reproduce this reliably

BarryCarlyon commented 3 years ago

I've also observed this screen.

But usuall;y before I've had a thought to hit continue, I've been redirected to my site. It's normally pretty quick.

Screenshot of the offending screen!

image

Emilgardis commented 3 years ago

I've seen this screen before, and not had issues with hitting continue. I can't reproduce it right now though.

swiftyspiffy commented 3 years ago

Also seeing this.

Syzuna commented 3 years ago

Reproduction Videos:

Success without clicking: https://cdn.syzuna-programs.de/images/j82ZBMLkbp.mp4

Failed with clicking: https://cdn.syzuna-programs.de/images/g5tsgP77Ht.mp4

The invalid state error in the video is just my server seeing the same state for an auth request id twice and killing the flow at that point. others would see an invalid code error from Twitch as their server tries to redeem the same code a second time

dimosmera commented 3 years ago

Also seeing this. Can reproduce it easily as well.

jbulava commented 3 years ago

The team that owns the authentication flow is aware of this double redirect issue due to clicking the "Continue" button. They will evaluate how to best mitigate the issue (e.g. remove the button, change the text to indicate only clicking if the browser doesn't redirect, etc) and we'll follow up on this post.

Aruvido commented 3 years ago

Hi, besides the continue button there is also a text that says "Redirecting you automatically, click here if your browser not redirect you." At the very start of the oAuth flow that produces the same bug as the continue button.

This text is only visible for users with slow connections, you can use the "Slow 3G" mode in Google Chrome to get it to show up.

image

BarryCarlyon commented 3 years ago

"Redirecting you automatically, click here if your browser not redirect you."

This is the new text. instead of the "continue" button.

image

At the very start of the oAuth flow that produces the same bug as the continue button.

Users should only click if it not redirected. So it should be more clear to the user not to press the link, unless they actually don't get redirected.... Hopefully....

BarryCarlyon commented 3 years ago

This "new flow" is causing this:

image

In firefox when you click "accept" on the oAuth dialog that pops up when installing/activating an extension and accepting/authing/allowing the subscribers scope.

Rather than the window auto closing after the oAuth is complete it shuts the flow down completely.

Firefox latest (94.0.1)

Syzuna commented 3 years ago

Reproduction video: https://cdn.syzuna-programs.de/images/rl9DtnZIy3.mp4

if you dismiss that screen and try again it runs into a loading loop: https://cdn.syzuna-programs.de/images/WmVDDQxkG8.mp4

aaronkchsu commented 2 years ago

Subscription related extensions will have an infinite loading screen on activate

image
talk2MeGooseman commented 2 years ago

I can confirm this is still happening on Firefox

streamstickers commented 2 years ago

Bump - Still happening on Firefox and blocking activations of our extension.

Marenthyu commented 2 years ago

This "new flow" is causing this:

image

In firefox when you click "accept" on the oAuth dialog that pops up when installing/activating an extension and accepting/authing/allowing the subscribers scope.

Rather than the window auto closing after the oAuth is complete it shuts the flow down completely.

Firefox latest (94.0.1)

Subscription related extensions will have an infinite loading screen on activate

image

I was able to reproduce these exact two issues on Mobile when installing a Sub-Enabled Extension. Mobile Google Chrome v 97 Screenshot_20220119-222620_Chrome.png

si7o commented 2 years ago

Also happens when trying to change the panel of an already active extension. (Firefox 98.0.1)

Console error:

The loading of “https://www.twitch.tv/extensions/oauth-redirect#access_token=xxxxxxxxx&scope=channel%3Aread%3Asubscriptions&token_type=bearer” in a frame is denied by “X-Frame-Options“ directive set to “SAMEORIGIN“

marcandrews commented 2 years ago

I am now receiving reports from extension users of this happening in Chrome and Safari, not just Firefox. Any updates on this issue @jbulava?

BarryCarlyon commented 2 years ago

I'm unable to replicate this in chrome. (Thought I'd go spot check, but it's all good for me in chrome)

marcandrews commented 2 years ago

It works for me too, but I have screenshots from users using Chrome, Firefox and Safari getting stuck on this auth modal.

jaku commented 2 years ago

Happy belated birthday to this bug! Surely no one uses Firefox so who cares right?

dennisrijsdijk commented 2 years ago

Happy belated birthday to this bug! Surely no one uses Firefox so who cares right?

🤬

marcandrews commented 1 year ago

Just had a user experience this on Safari iOS ... https://discord.com/channels/183961840928292865/1057403456341672066

BarryCarlyon commented 1 year ago

Still present today :-(

With the old x-frame-options issue

jaku commented 1 year ago

Cannot confirm if this is the same issue, but this is for sure happening on Chrome and Edge for users, including myself currently. Still investigating if this is the same bug or something new. But the same sort of issue.

Edit:

Different bug, looks like the flow is trying to direct the user to localhost.rig.twitch.tv:8080 which isn't going to work.

Emilgardis commented 1 year ago

You'll get the same message if the url specified in the redirect_uri is not in the allowed redirects on the console @jaku

BarryCarlyon commented 1 year ago

For browsers that are not Firefox and for Extension Activation:

The temporary solution, until Twitch bypass trusts itself, is to add https://www.twitch.tv/extensions/oauth-redirect as a redirect URI to your Extension Settings -> OAuth Redirect URL list

BarryCarlyon commented 1 year ago

The above affecting all is fixed but the general issue for firefox is still present

Today it's reported as a NS_ERROR_XFO_VIOATION

Xemdo commented 1 month ago

Ticketed internally as COCO-638 Ticketed internally as IDPLAT-8650