Getting a token: 400 Bad Request

Most likely, it was necessary to transfer any data to the CURLOPT_POSTFIELDS.