Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for app state argument #485

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

navaronbracke
Copy link

@navaronbracke navaronbracke commented Nov 19, 2024

Fixes #486

  • 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

This PR adds support for the appState parameter to loginWithRedirect() for the web.
See https://github.com/auth0/auth0-spa-js/blob/f2e566849efa398ca599daf9ebdfbbd62fcb1894/src/global.ts#L298

There is prior art in auth0/auth0-angular#168

🎯 Testing

Added 1 unit test. This can be tested end-to-end by setting up a login with redirect, that uses the app state argument as parameter, and then validating that the app state is returned when the user is redirected back.

@navaronbracke navaronbracke requested a review from a team as a code owner November 19, 2024 16:16
@@ -160,6 +161,32 @@ void main() {
expect(params.max_age, null);
});

test('loginWithRedirect supports appState parameter', () async {
Copy link
Author

@navaronbracke navaronbracke Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the tests using flutter test --platform=chrome --tags=browser -v but I didn't see my test name in the verbose output? Is there a way to run this test locally?

Edit: Running with flutter test --platform=chrome --name=loginWithRedirect did make it show up (or maybe I missed it)

@@ -21,6 +21,7 @@ dependency_overrides:

dev_dependencies:
build_runner: ^2.1.8
collection: ^1.18.0
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the MapEquality in the test, hence a dev dependency

@navaronbracke navaronbracke marked this pull request as draft November 20, 2024 09:08
@navaronbracke
Copy link
Author

It seems I still missed a step, as the app state is not passed to the redirect url when actually coming back to the app. Once that is fixed, this is ready for review.

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.

The appState parameter is missing for login with redirect on the web
1 participant