returnTo Url is not working in react sdk

My Logout Button,

const LogoutBtn = () => {
  const {
    isAuthenticated,
    logout,
  } = useAuth0();

  const handleLogout = () => {
    const returnToUrl = window.location.origin || 'https://weplaydos.games';
    console.log('Logging out, returnTo:', returnToUrl);
    logout({ returnTo: returnToUrl });
  };

  return isAuthenticated && (
    <Button
      renderIcon={Logout}
      kind='ghost'
      onClick={handleLogout}>
      Log out
    </Button>
  );
}

It is being passed from the sdk but when I check the network tab, I see this url - https://dev-y27lxavr02scmif8.us.auth0.com/v2/logout?client_id=jclY1uHk29dMQCtQqkRPUlJI2Cd5mRwA&auth0Client=eyJuYW1lIjoiYXV0aDAtcmVhY3QiLCJ2ZXJzaW9uIjoiMi4yLjQifQ%3D%3D

Can anyone help?

I am using a single application in 2 domains. And I have configured the logout urls on application level and also at the global level. Would really appreciate the help.

Login and redirection is working absolutely fine. It is just the Logout. It redirects the user to the other domain that is configured which is because of the missing returnTo param.

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