https://supabase.com/ logo
Still trying to get Sign Up redirect to work with ...
# help
a
Still trying to get Sign Up redirect to work with Sveltekit-auth-helper. The target route has a form with an endpoint to load the data. It seems that the withApiAuth function is causing the redirect to be redirected to the index route... Presumably because of a problem with the session cookie? If I remove the withApiAuth guard the page eventually loads, but then I don't have a protected route. I can think of few ways to work around this but I think I'm missing something obvious.
Copy code
export const GET = async ({ locals, request }) =>
    withApiAuth(
        {
            user: locals.user
        },
        async () => {
            const { data: profile, error } = await supabaseServerClient(request)
                .from('profile')
                .select('*')
                .eq('id', locals.user.id);
            if (error) {
                console.log('error Get Profile for Survey:', error);
                return {
                    status: 400,
                    body: { error }
                };
                return {
                    status: 200,
                    body: { surveyData }
                };
            }
            return {
                status: 400,
                body: {}
            };
        }
    );
n
Hello @AlanK! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
s
Take a look at the magic link example, also how would you redirect to a protected page when the user isn't logged in as yet? this is a sign up not a sign in.
a
Thanks again for another example. I did get a rush of blood to the head after I posted , but it is reassuring to have confirmation from someone who knows what they're doing. 🙏
n
Thread was archived by @AlanK. Anyone can send a message to unarchive it.