Issue with implementing Login in my Angular Application - Getting 401 Unauthorized Response

My Login flow is as follows:
I have a landing page with a login button. Upon clicking the login button, users are redirected to the Login Component which checks if the User is Logged In. If the user is Logged In, it is considered to be a successful login. If the user is not Logged In, this.auth.loginWithRedirect() is called with the current URL as a target in the state. Once the Login is complete in Auth0 it has to redirect to the Validate User Component where the handleRedirectCallback() is present which handles validates user login.

Expected Output:
User to Land on the Landing Page, click on Login. Go to the login page from where the Auth0 Login process is done. Post Auth0 login it’s redirected to a Validate User where handleRedirectCallback() handles successful login.

Output:
The Login Process works well until Auth0 Login. Post that it is redirected to Validate User as expected but over there the following error is thrown:
Callback processing error: _d: Invalid state
at te.
Also, automatically it is being redirected to the Landing Page(at http://localhost:4200).
Also, another error is thrown with the following message:
POST https://…eu.auth0.com/oauth/token 401 (Unauthorized)