How to redirect user on client side with remix template | Shopify APP

zouker
Shopify Partner
3 0 0

I'm making a Shopify app where the user needs to log into their account to be able to use the app. When the login is successful I want the user to be redirected, but I can't do it.

what I've already tried:

 

redirect('/app/produtcs');

window.location.href = '/app/produtcs';

 

The problem I'm having is that when redirecting it sends me to the correct page but displays this screen instead of the page I want. remembering that I am trying to do server-side redirection, without the loader.

 

imagem_2024-03-04_124026176.png

 

Reply 1 (1)

juan_fero
Shopify Partner
1 0 0

Hello Zouker!

 

Stepped into this same problem just yesterday and solved it 🙂

 

You need to use the `redirect` function from the authenticate method, like this:

const { admin, redirect } = await authenticate.admin(request);
redirect('some/where');

 Hope it helps!