Incorrect location header is displayed in the response when /u/login auth endpoint being hit

I am trying to generate Cookies value using authorize endpoing and following below mentioned process.

  1. Start the flow by calling the /authorize endpoint
  2. You will be redirected to /u/login endpoint, capture the state parameter here.
  3. Make a POST request to /u/login endpoint. Use the state parameter in both Request Body and Request Params. Also, pass the username and password in the body (x-www-form-urlencoded)

As a response I am getting 302 response code as expected but location value returned is incorrect

Expected: /authorize/resume?
Actual: It displayed some url related to application login page with garbage values

Please let me know anything is missing or any settings related to it