Logout not logging out with React SDK

Please include the following information in your post:

  • Which SDK this is regarding: auth0-react
  • SDK Version: 1.8.0
  • Platform Version: Node 16.11.1
  • Code Snippets/Error Messages/Supporting Details/Screenshots:

Is this a feature request or bug report? If so, please create an issue directly in the corresponding GitHub repo. The Community SDK category is for general discussion and support.

I have a button:

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

  return <Button displayonClick={() => logout({ returnTo: window.location.origin })}>Auth0 Logout</Button>;
};

But upon clicking it, I am not logged out. I am not redirected or logged out - nothing happens.

My auth0 provider looks like this:

    <Auth0Provider
      domain="myDomain.us.auth0.com"
      clientId="{{redacted}}"
      redirectUri={window.location.origin}
      audience="{{redacted}}"
      >
     ...
</Auth0Provider>

I’m kind of at a loss and cannot figure out why I’m not being logged out.

There’s also a secondary issue - unsure if it’s related: every time I refresh the webpage I am given a new access token and I’m unsure why. Surely I should retain the same access token for a while?