Mac
01/07/2022, 8:04 PMredirectTo
to http://localhost:3000/foobar
, upon successful auth I will be taken to http://localhost:3000/foobar#access_token=123abc&expires_in=3600&you_get=the_idea
, and that's it, hash will stay there.redirectTo
option for signIn
as well as a workaround I've come up with3.2.16
with Vue Router version 4.0.11
and Supabase client version 1.29.1
ts
const redirectPath = route.query.redirect as string;
const redirectTo = `${window.location.origin}${redirectPath || '/'}`;
const { error } = await supabase.auth.signIn({ provider }, { redirectTo });
And it does successfully redirect me to that desired address, but as I said, the auth data hash does not get cleared by Supabase/GoTrue clientafterEach
guard for my router:
ts
import { NavigationFailure, RouteLocationNormalized } from 'vue-router';
export function clearHashGuard(
from: RouteLocationNormalized,
to: RouteLocationNormalized,
failure: void | NavigationFailure | undefined
) {
// Hash gets cleared properly on Home view
// And I need to preserve query params on SignIn
if (!['Home', 'SignIn'].includes(from.name as string)) {
history.pushState(
{},
document.title,
window.location.pathname + window.location.search
);
}
}