I want to use auth0 in the web while using flutter.
The docs from auth0 (Auth0 Flutter (Web) SDK Quickstarts: Add login to your Flutter app) say to include this line of code in the index.html:
<script src="https://cdn.auth0.com/js/auth0-spa-js/2.0/auth0-spa-js.production.js" defer></script>
But if I include that and start in chrome I get this message while the chrome tab that opened up is all white:
Flutter: Waiting for connection from debug service on Chrome...
This a clean project with and no other changes happend to any settings files, only the index.html.
The body part of the index.html:
<body>
<script src="https://cdn.auth0.com/js/auth0-spa-js/2.0/auth0-spa-js.production.js" defer></script>
<script src="flutter_bootstrap.js" async></script>
</body>
I have no errors or logs available it only tells the message from above.
This error only happens if I start in debug mode. Release mode works sometimes.
Any ideas on how to fix this?
Hi @MeshApps, and sorry for the late reply!
While I cannot identify the problem from your snippet alone, since you mentioned this is a clean project, I suggest downloading the sample Flutter (Web) app from the Auth0 Dashboard and using it as an example. I will also provide you with a snippet that shows how the index.html is set up in the sample app.
<!DOCTYPE html>
<html>
<head>
[...]
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
<script src="https://cdn.auth0.com/js/auth0-spa-js/2.0/auth0-spa-js.production.js" defer></script>
</head>
<body>
<script>
window.addEventListener('load', function(ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function(engineInitializer) {
engineInitializer.initializeEngine().then(function(appRunner) {
appRunner.runApp();
});
}
});
});
</script>
</body>
</html>
Please let me know if there is more I can help you with!
Teodor.