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

V4 set returnTo or post_logout_redirect_uri during logout #1797

Closed
5 tasks done
brandicph opened this issue Nov 11, 2024 · 8 comments
Closed
5 tasks done

V4 set returnTo or post_logout_redirect_uri during logout #1797

brandicph opened this issue Nov 11, 2024 · 8 comments

Comments

@brandicph
Copy link

Checklist

  • I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Describe the problem you'd like to have solved

In V4, it is not possible to redirect users to a specific destination when we log users out.

Describe the ideal solution

Allow users to provide a returnTo or post_logout_redirect_uri as part of the handleLogout process.

url.searchParams.set("post_logout_redirect_uri", this.appBaseUrl)

An idea is to add a returnTo to the post_logout_redirect_uri with a fallback to the appBaseUrl.

- url.searchParams.set("post_logout_redirect_uri", this.appBaseUrl)^
+ url.searchParams.set("post_logout_redirect_uri", returnTo || this.appBaseUrl)

This should ultimately allow users to do something like this

/auth/logout?returnTo=https%3A%2F%2Flocalhost%3A3000%2Fanother-logout-destination

Alternatives and current workarounds

No response

Additional context

No response

@brandicph
Copy link
Author

cc @guabu

@guabu
Copy link

guabu commented Nov 11, 2024

Hi @brandicph 👋 We can definitely allow for different logout URLs to be specified via the returnTo as you mentioned — the only thing to note is that would require registering each URL in the Allowed Logout URLs of your client. Would that work for your use case?

@brandicph
Copy link
Author

Hi @brandicph 👋 We can definitely allow for different logout URLs to be specified via the returnTo as you mentioned — the only thing to note is that would require registering each URL in the Allowed Logout URLs of your client. Would that work for your use case?

@guabu that is perfect 👌 np. we are used to the process of registering each URL in the client's Allowed Logout URLs. 🤙

@guabu
Copy link

guabu commented Nov 11, 2024

Sounds good, I'll get that added in the next release this week. I'll keep you posted once it's been added!

@guabu guabu mentioned this issue Nov 11, 2024
@brandicph
Copy link
Author

Sounds good, I'll get that added in the next release this week. I'll keep you posted once it's been added!

Amazing @guabu 🙏 thx

@alioftech
Copy link

image
Hey guys, you are still lagging behind.
I expect more from you than Clerk

@guabu
Copy link

guabu commented Nov 14, 2024

Hey @brandicph 👋 We've just cut a new release which should now allow you to pass the logout URL in the returnTo query parameter. The README docs have also been updated to reflect that.

Please feel free to upgrade to the latest and give it a shot: npm i @auth0/[email protected]

@brandicph
Copy link
Author

Hey @brandicph 👋 We've just cut a new release which should now allow you to pass the logout URL in the returnTo query parameter. The README docs have also been updated to reflect that.

Please feel free to upgrade to the latest and give it a shot: npm i @auth0/[email protected]

Amazing @guabu - already installed 😎 Thanks for the fast response!

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

No branches or pull requests

4 participants