'Auth0 redirect infinite loop Vue3

This is the code block I have. I know the cause of it is because setup will always default back to not authenticated once I am redirected back to the website. My experience with vue is very limited and have no idea how to fix this. Someone please help me out with this or guide me in the right direction.

 export default {
  name: "HomeView",
  components: {},
  setup() {
    const { loginWithRedirect, user, isAuthenticated } = useAuth0();

    return {
      loginWithRedirect,
      user,
      isAuthenticated,
    };
  },
  mounted() {
    if (!this.isAuthenticated) {
      this.loginWithRedirect();
    }
  },
};


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source