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
51 stars 50 forks source link

Redirect not working when deployed, only using localhost #50

Closed DragonSlayer88 closed 1 year ago

DragonSlayer88 commented 1 year ago

Hello, it seems i cant get this working and not sure if it is a bug or not. I have working code that allows me to log fine when using localhost. But as soon as I deploy it on IIS and change the redirect url to the hosting ip, it stops working. I am using the flutter web version so i use a static .html page to redirect to. This page works fine as I can call it manually when the site is hosted. But when i try to run the FlutterWebAuth2.authenticate method, and sign in, it never returns to code. So im guessing the redirect isnt working for some reason. Really not sure why as again I can redirect to the static html page manually from my PC to the hosting PC.

Here is a bit of my code, but there isnt much to see really.

String url1String = 'https://test-api1.xxx.com/v1/user/authorization?response_type=code&client_id=XXXredirect_uri=http://xx.xx.xx.xx:80/logindirect.html&scope=uid%20openid%20email%20profile_conexiom';

final result = await FlutterWebAuth2.authenticate(url: url1String, callbackUrlScheme: 'http');

    final code = Uri.parse(result).queryParameters['code'];

When this is used like this: with localhost:49430, it works fine. What gives?

String url1String = 'https://test-api1.xxx.com/v1/user/authorization?response_type=code&client_id=XXXredirect_uri=http://localhost:49430/logindirect.html&scope=uid%20openid%20email%20profile_conexiom';

ThexXTURBOXx commented 1 year ago

In the future, please refrain from contacting me via email about GitHub issues. I get an email anyways when you report one :) I cannot reproduce this issue: https://femtopedia.de/flutterwebauth2 I also think that this might be the same issue as #44

DragonSlayer88 commented 1 year ago

It is a CORS issue when deploy vs running locally. Nothing to do with the package here. Sorry about the confusion. Im still trying to work it out. Thanks!

ThexXTURBOXx commented 1 year ago

No problem and good luck fixing that!