Skip to content

Conversation

@JCQuintas
Copy link

@JCQuintas JCQuintas commented Dec 22, 2023

  • 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.

@JCQuintas JCQuintas requested a review from a team as a code owner December 22, 2023 12:41
@JCQuintas
Copy link
Author

@Widcket @poovamraj Hi, please let me know if I am missing any step for this to be reviewed 😄

@Widcket Widcket requested a review from a team as a code owner February 10, 2025 22:29
@Widcket
Copy link
Contributor

Widcket commented Feb 10, 2025

Hi @JCQuintas, thanks for your contribution and apologies for the delay. I'll try to get to this PR by EOW.

@codecov
Copy link

codecov bot commented Feb 10, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 82.89%. Comparing base (253209a) to head (c3211cc).
⚠️ Report is 242 commits behind head on main.

Files with missing lines Patch % Lines
...platform_interface/lib/src/web/logout_options.dart 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##               main     #393       +/-   ##
=============================================
- Coverage     96.08%   82.89%   -13.20%     
=============================================
  Files            97      108       +11     
  Lines          1611     1877      +266     
  Branches        331      424       +93     
=============================================
+ Hits           1548     1556        +8     
- Misses           49      308      +259     
+ Partials         14       13        -1     
Flag Coverage Δ
auth0_flutter 91.42% <ø> (-8.58%) ⬇️
auth0_flutter_android 80.65% <ø> (-15.91%) ⬇️
auth0_flutter_ios 83.78% <ø> (-16.07%) ⬇️
auth0_flutter_platform_interface 81.06% <50.00%> (-5.97%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trevordunn
Copy link

@JCQuintas @Widcket Any updates on this? The openUrl param would be really handy for an app I'm working on as well.

@Widcket
Copy link
Contributor

Widcket commented Apr 29, 2025

cc @pmathew92

@pmathew92
Copy link
Contributor

Hi all, apologies on the delayed response. We will review this and plan to include this PR in our coming releases. @JCQuintas could you please resolve the merge conflicts ?

@JCQuintas
Copy link
Author

Hi @pmathew92, I don't work with Flutter anymore so it would be hard for me to validate the changes, anyone interested can take over this PR.

@dnlsilva
Copy link

Hey @pmathew92 do you have any plans to merge this PR yet?
I can fix the lint errors as I have a similar issue here.

@pmathew92
Copy link
Contributor

Hi @dnlsilva , thanks for showing your interest on this issue. Yes if you can fix the errors, we can review and plan to merge this

@trevordunn trevordunn mentioned this pull request Nov 24, 2025
2 tasks
@trevordunn
Copy link

I tried picking this back up in PR #685, but got held up with issue #686.

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.

5 participants