Not able to login and stay in same login screen when try to login through Back to login Button

Actually, my problem is after this scenario.

After redirecting to login, when I tried to login with credentials it was not working. I’m getting a 302 error code.