Skip to content

Conversation

beblife
Copy link
Contributor

@beblife beblife commented Jul 25, 2025

This PR allows customizing the return/redirect URL when logging out.
Scenario I encountered when using a WorkOS staging environment where this would be useful:

Configured "Logout redirects" in WorkOS:

  • local-domain.test
  • staging-domain.laravel.cloud (Default)

Actual redirects:

local-domain.test/logout -> staging-domain.laravel.cloud
staging-domain.laravel.cloud /logout -> staging-domain.laravel.cloud

Preferred redirects:
local-domain.test/logout -> local-domain.test
staging-domain.laravel.cloud /logout -> staging-domain.laravel.cloud

The first redirect can be achieved by swapping the "Default" in WorkOS but is less ideal.

There's a second optional $return_to parameter on ->getLogoutUrl() that will select one of the configured "Logout redirects" (see https://workos.com/changelog/custom-logout-uris) with a fallback to the configured homepage.

@taylorotwell taylorotwell merged commit 065df71 into laravel:main Jul 26, 2025
7 checks passed
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