https://supabase.com/ logo
Supabase is pretty amazing at databasey things, bu...
# help
i
Supabase is pretty amazing at databasey things, but I struggle a bit with common auth-like patterns even after the recent updates For example, many example repos are set up so that you stay on the same page you logged in on, but show different content once the user object is full. I'd like to identify the user server-side and redirect them to a different page/route on success. It seems that between Next.js and the updated Auth Helpers, this isn't a possible thing. getUserByCookie doesn't work and supabaseClient.auth.session() returns an access_token which, if nothing else, at least lets me know there's a real or non-logged-out person, to use as a conditional to force a redirect. But the redirects away to the destination implode, presumably because the destination page is guarded from logged-out users and redirects back to the same place they just came from -- as if the destination page didn't know who they were. I cannot find a simple, basic working example of this, and can find five or six GitHub threads talking about it or around it, so I feel like I'd just muddy the waters to add another one. Is there some inherent aspect to node/React/Next/Supabase that prevents it?
n
Hello @InASunshineState! 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.
i
I took someone's idea of using useRouter to throw to an API route that redirects, and there's no disruptive flashing of screens nor big flashy errors. I do notice, however, that only sometimes it'll go right back to the login screen except now the #access_token is in the address. This is with a Google Auth provider. I am not even sure how to debug this.
s
What you are asking is only possible if you are doing email and password login, once you are doing magic link or third party login this isn't possible at the moment.
i
Thanks, @silentworks . Is there somewhere I can go to read up more on why that's the case? Just to increase my understanding of the ecosystem?
n
Thread was archived by @InASunshineState. Anyone can send a message to unarchive it.