Redirect after SignOut #357

Closed
opened 2026-03-13 07:43:06 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @emersonlaurentino on GitHub (Dec 7, 2024).

After Sign Out, I want to redirect, so I think this can be like that:

Manually

signOut({
  redirectUri: "/login"
})

or by config

createAuthClient({
  baseURL: import.meta.env.VITE_API_URL,
  signOutRedirectUri: "/login",
});
Originally created by @emersonlaurentino on GitHub (Dec 7, 2024). After Sign Out, I want to redirect, so I think this can be like that: Manually ```tsx signOut({ redirectUri: "/login" }) ``` or by config ```tsx createAuthClient({ baseURL: import.meta.env.VITE_API_URL, signOutRedirectUri: "/login", }); ```
Author
Owner

@Bekacru commented on GitHub (Dec 7, 2024):

you should redirect yourself using your framework router or using window.location yourself using onSuccess callback. This is to avoid hard redirects.

signOut({
   fetchOptions: {
     onSuccess: async()=>{
        //redirect here
    }
  }
})
@Bekacru commented on GitHub (Dec 7, 2024): you should redirect yourself using your framework router or using window.location yourself using `onSuccess` callback. This is to avoid hard redirects. ```ts signOut({ fetchOptions: { onSuccess: async()=>{ //redirect here } } }) ```
Author
Owner

@emersonlaurentino commented on GitHub (Dec 7, 2024):

great, it's work for me

@emersonlaurentino commented on GitHub (Dec 7, 2024): great, it's work for me
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#357