Skip to content

Conversation

@trevordunn
Copy link

This is a continuation of #393, which seems to have gone stale.

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

📋 Changes

  • Adds support for the openUrl parameter in both loginWithRedirect and logout on the browser version.
  • openUrl requires auth0-spa-js version 2.0.1 or later.
  • It makes the lib more closely aligned with the auth0-spa-js lib which is used underneath.

This is important to me due to the @microsoft/teams-js library necessary to do authentication inside microsoft teams, reference docs here

In short, it handles authentication in its own window.

authentication.authenticate({
    url: window.location.origin + "/tab-auth/simple-start-v2",
    width: 600,
    height: 535})

My use case would be something similar to

auth0.loginWithRedirect(openUrl: (auth0Url) async {
  authentication.authenticate(
    url: "$auth0Url/tab-auth/simple-start-v2",
    width: 600,
    height: 535
  )
})

🎯 Testing

  • In order to test, replace the auth0-spa-js version from 2.0 to 2.0.1 at auth0_flutter/example/web/index.html
  • Add the snippet below to loginWithRedirect and logout functions
openUrl: (final url) async {
  debugPrint(url);
  window.location.replace(url);
}
  • Ensure you will see the urls printed on the console.

Possible concerns

While manual testing, you will also see two errors in the web console:

  • Error: Promise was rejected with a value of 'undefined'
  • TypeError: T.as is not a function

From my tests, this seems be comming out of the main auth0-spa-js library due to unhandled rejections, and doesn't affect the usage of auth0_flutter itself. Though it would require a deeper research on why it is happening.

@trevordunn
Copy link
Author

Stalled on finishing this until #686 is resolved.

@trevordunn trevordunn mentioned this pull request Nov 24, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants