auth0 / auth0-flutter

Auth0 SDK for Flutter
https://pub.dev/documentation/auth0_flutter/latest/
Apache License 2.0
59 stars 39 forks source link

Error after redirect #296

Closed itaishalom closed 1 year ago

itaishalom commented 1 year ago

Checklist

Description

This my code:

  Future<TokenResponse> test( String organization, List<String> promptValues) async {
    Completer temp = Completer();
    final auth0Web = Auth0Web('my-domain', this._clientId);
    if (kIsWeb) {
      auth0Web.onLoad().then((final credentials) {
        if (credentials != null) {
          resp = TokenResponse(
              "accessToken", credentials!.refreshToken, null, credentials.idToken, "tokenType", scopes, {});
              logger.i("resp is " + resp.toString());
              temp.complete();
        } else {
          logger.i("not logged in");
          // Not logged in
        }
      });
    }
    if (kIsWeb) {
        Map<String, String> parameters = {'prompt': 'login'};
        await auth0Web.loginWithRedirect(redirectUrl: 'http://localhost:3000', organizationId: organization.isEmpty ? null:organization ,scopes: scopes.toSet(), parameters:  parameters);
      }
    await temp.future;
    return resp!;
  }

This causes the app to loop when I run it on port 3000 (it's defined on our Auth0 page) The app restarts after the login with auth0 page. I guess the redirect works but the app restarts.

Reproduction

Above.

Additional context

No response

auth0_flutter version

1.2.1

Flutter version

3.10.3

Platform

Web

Platform version(s)

No response

Widcket commented 1 year ago

Hi @itaishalom, thanks for raising this.

Can you reproduce this in the sample app?

Widcket commented 1 year ago

Closing due to inactivity. Please feel free to ping if you'd prefer to reopen.