fix: restore original URL after OAuth login redirect
Save the intended destination to sessionStorage before navigating to the OAuth provider, and read it back in AuthCallback after login. Also handles 401-triggered redirects so session-expired users are returned to the page they were on. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,11 @@ function AuthCallback() {
|
||||
useEffect(() => {
|
||||
const handleCallback = async () => {
|
||||
const token = searchParams.get('token');
|
||||
const redirect = searchParams.get('redirect') || '/';
|
||||
const redirect =
|
||||
searchParams.get('redirect') ||
|
||||
sessionStorage.getItem('oauth_redirect') ||
|
||||
'/';
|
||||
sessionStorage.removeItem('oauth_redirect');
|
||||
|
||||
if (!token) {
|
||||
setError('No authentication token received');
|
||||
|
||||
Reference in New Issue
Block a user