The issue is that, after a successful login, the user is redirected to the welcome screen. However, the API returns a 401 Unauthorized error for some reason. This causes the user to be redirected back to the login screen. Since the user is already logged in, the login screen then sends them back to the welcome screen, resulting in an infinite loop. Why is the API returning a 401 error after a successful login?