ThexXTURBOXx / flutter_web_auth_2

Flutter plugin for authenticating a user with a web service
https://pub.dev/packages/flutter_web_auth_2
MIT License
57 stars 55 forks source link

[Bug]: <Broken redirect> #116

Closed Jesse-Abruzzo closed 4 months ago

Jesse-Abruzzo commented 4 months ago

Description

I havent changed my code for awhile and everything has been working fine. as soon as i updated this package to 3.1.2 and flutter to 3.22 the redirect stopped working. It goes to the html page but never redirects back to the org tab like it always did.

Minimal Reproduction

Steps to reproduce the behaviour:

  1. Use the following code:
     final result = await FlutterWebAuth2.authenticate(url: url1String, callbackUrlScheme: 'https');
     final code = Uri.parse(result).queryParameters['code'];
  2. It normaly would come back to the tab and then parse the code out. this was working fine for months. updated the package and flutter version and it doesnt come back. wont redirect back from my html page.

Exception or Error

No visible error messages

Expected Behaviour

redirect properly

Screenshots

No response

Additional context

No response

Device

Flutter web

OS

Windows 12

Browser

Chrome, EDGE

Flutter version

3.22

flutter_web_auth_2 version

3.1.2

Checklist

ThexXTURBOXx commented 4 months ago

Please fill in all the fields

Jesse-Abruzzo commented 4 months ago

What else do you need to know specifically?

Jesse-Abruzzo commented 4 months ago

actually i see this error in the console from chrome: logindirect.html?code=codehere

Uncaught TypeError: Cannot read properties of null (reading 'postMessage') at logindirect.html?code=codehere

Hope this helps the issue. Please get back to me asap. THanks!

Jesse-Abruzzo commented 4 months ago

So i downgraded to version 2.1.4 and it works again. it was the upgrade that broke something. Can you please check that out.

ThexXTURBOXx commented 4 months ago

When upgrading to 3.x, have you applied the current version of the Web setup like this?

Jesse-Abruzzo commented 4 months ago

That was it. Thank you. Needed the new web setup. Didnt know that changed with the new version. thank you

ThexXTURBOXx commented 4 months ago

You're welcome :) For the 4.x versions, the Web setup should be the same, by the way (if you want to test it out)