How do I get the state after redirect from rule, in a react app?

I need to get the state after redirect in order to send it back with the continue redirect, when and how do I get the state in the client side?
From what I’ve seen, people are avoiding redirect in react.

Hi @reuven.josef.k,

Welcome to the Community!

It sounds like you are referring to a redirect rule. Assuming that is the redirect you are talking about, it should be available as a param in the URL. Like this:

https://example.com/foo?state=abc123

Thank you for the answer.
I’ve got another question,
I tried redirecting to the continue route with the state parameter, using the react-router-dom redirect component, The redirect is happening with the state, but the user is not authenticated.
I also tried adding a get request to an express server, but I can’t accept the redirect because of cros.
It’s not clear how this works, how dose Auth0 know if I made a redirect to the continue route?

Can you expand on what is happening here? The tokens are never returned to your application? Or rules are not resuming because your request to /continue is not being accepted?

I’m not sure I understand this question. Auth0 will receive the /continue request and continue running through the authentication pipeline.

In the documentation the continue request looks like this:

https://YOUR_DOMAIN/continue?state=THE_ORIGINAL_STATE

It wasn’t cleat to me if you mean my Auth0 domein or my own domain, however how is it safe to make a request to another domain, It’s blocked by Cross-Origin policy?

I’ve moved on from this, I found a different solution without redirecting.

Thank you for your help.

1 Like

Thanks for providing an update.

I’ll answer your question for future users who see this.

The /continue endpoint expects the Auth0 domain you have been given or configured.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.