auth0-flutter icon indicating copy to clipboard operation
auth0-flutter copied to clipboard

Support new bootstrap method in Flutter 3.22

Open EduardoYamauchi opened this issue 1 year ago • 5 comments

Checklist

  • [X] The issue can be reproduced in the auth0_flutter sample app (or N/A).
  • [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • [X] I have looked into the API documentation and have not found a suitable solution or answer.
  • [X] I have searched the issues and have not found a suitable solution or answer.
  • [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • [X] I agree to the terms within the Auth0 Code of Conduct.

Description

Description:

With the release of Flutter 3.22, the method for bootstrapping has changed, as outlined in the official documentation: Flutter Web Bootstrapping. As a result, the Auth0 integration no longer works with this new method.

Issue:

• The previous bootstrap method is now deprecated and will soon stop functioning entirely.
• The Auth0 package needs to be updated to support the new bootstrapping method introduced in Flutter 3.22.

Request:

Please provide support for the new bootstrap method in Flutter 3.22. This is crucial to ensure continued compatibility and functionality of Auth0 with Flutter web applications.

Thank you for your attention to this matter.

Reproduction

1 - Follow the guide to update the bootstrapping in: https://docs.flutter.dev/platform-integration/web/bootstrapping 2 - Try to build an web application with auth0_flutter: 1.7.2

Additional context

No response

auth0_flutter version

1.7.2

Flutter version

3.22

Platform

Web

Platform version(s)

No response

EduardoYamauchi avatar Jun 11 '24 19:06 EduardoYamauchi

I'm facing the same issue. Auth0 becomes completely unusable for web and is critical for my workflow

amangsingh avatar Jun 26 '24 14:06 amangsingh

Any updates on this?

Solano-Furlan avatar Jul 11 '24 19:07 Solano-Furlan

Hi @EduardoYamauchi, @amangsingh, @Solano-Furlan,

Apologies for the delay in looking into this,

I've just tried using the flutter sdk version 1.7.2 with the flutter versions 3.22.0 & 3.24.0 in both debug, release modes and everything is working as expected, can anyone of you help us with a reproducible example or steps to reproduce ?

desusai7 avatar Aug 20 '24 12:08 desusai7

I tested again using:

  • auth0_flutter: 1.7.2
  • Flutter (Channel stable, 3.24.2, on macOS 14.6.1 23G93 darwin-arm64).

And everything's is working as expected. I'm closing this issue, if you still having some issue related with the new bootstrap please send me a message to re-open.

Thank you.

EduardoYamauchi avatar Sep 04 '24 17:09 EduardoYamauchi

I’m reopening this issue due to the following error:

TypeError: Cannot read properties of undefined (reading 'Auth0Client')
packages/auth0_flutter/src/web/auth0_flutter_plugin_real.dart 30:25  initialize
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54   runBody
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5   _async
packages/auth0_flutter/src/web/auth0_flutter_plugin_real.dart 27:26  initialize
packages/auth0_flutter/auth0_flutter_web.dart 56:44                  onLoad
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54   runBody

This error occurs randomly only when switching to the new bootstrap mode.

Steps to reproduce (on web):

  1. Add the required line for the web version in the index.html (following the documentation):

<script src="https://cdn.auth0.com/js/auth0-spa-js/2.0/auth0-spa-js.production.js" defer></script>

Screenshot 2024-09-16 at 15 49 46
  1. Run the following lines:
void main() async {
  var auth0Client = Auth0Client();
  await auth0Client.auth0Web!.onLoad();
}

I have been patiently waiting for the resolution of the WASM issue, which has now been open for 4 months since June. This is particularly important as it relates to performance and security of our applications.

EduardoYamauchi avatar Sep 16 '24 18:09 EduardoYamauchi

simply removing defer resolves it for me

<script src="https://cdn.auth0.com/js/auth0-spa-js/2.0/auth0-spa-js.production.js"></script>

sw1jari avatar Dec 18 '24 23:12 sw1jari

@sw1jari If you remove this line you wont be able to deploy in production env

EduardoYamauchi avatar Feb 28 '25 16:02 EduardoYamauchi

This is now out in v1.9.0.

Widcket avatar Mar 05 '25 13:03 Widcket

Any update on this? I can only use this package either with the old bootstrapping (like the example app is using) or by removing defer on the spa-js, otherwise I'm getting TypeError: Cannot read properties of undefined all the time

you should update the example to the new bootstrapper

YMandarin avatar Jul 28 '25 20:07 YMandarin

Hi @YMandarin , Have you tried the v1.9.0 version of the Auth0 flutter SDK ?

pmathew92 avatar Jul 29 '25 05:07 pmathew92

isn't 1.12.0 the newest?

maybe I'm using an older version, I'll check

YMandarin avatar Jul 29 '25 07:07 YMandarin

@YMandarin , Yes 1.12.0 is the latest. Please confirm if you are observing the issue in the latest version also . We will take a look into this

pmathew92 avatar Jul 29 '25 08:07 pmathew92

ah yes I was using an older version... I'm sorry x_x

But you should still upgrade the example

YMandarin avatar Jul 29 '25 09:07 YMandarin