Okta Integration with Drupal 7 App

Hi Team,

We have successfully integrated Okta with our Drupal application. We used the openid connect module (https://www.drupal.org/project/openid_connect). Added the necessary configuration details to point to the OKTA server.
Since our DC hosts cannot directly communicate with any external sites, we need to connect external sites through the proxy server. So we edited the settings.php file to add the proxy data.
Post this when user accesses the Drupal app, user is redirected to OKTA login. User keys in credentials and authentication is successful.
Drupal app then tries to access the userinfo url which return bad request. We tried to run the same command as curl command on the host in which application is hosted, it returns correct user data.

Request ::
GET
https:\dev-345757.oktapreview.com\oauth2\v1\userinfo
Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjljeHFuT0hMWjdSS045TE1QTWZ1QzM0d0g2bkM4QWZPaXBWcThMNi1ZTTAifQ.eyJ2ZXIiOjEsImp0aSI6IkFULi1KN215YUh3WWJrX1JRMlF3ZFF6OGxVTHRfUld1T0dzOV9Mazg4dnhieEUiLCJpc3MiOiJodHRwczovL2Rldi0zNDU3NTcub2t0YXByZXZpZXcuY29tIiwiYXVkIjoiaHR0cHM6Ly9kZXYtMzQ1NzU3Lm9rdGFwcmV2aWV3LmNvbSIsInN1YiI6InJhamFzZWtoYXJAMjQ3LWluYy5jb20iLCJpYXQiOjE1MDg3NjI3NzEsImV4cCI6MTUwODc2NjM3MSwiY2lkIjoiMG9hYzVocjFwekhLeG95ZmkwaDciLCJ1aWQiOiIwMHVjNG9qZWxoT0l4RWhZWTBoNyIsInNjcCI6WyJwcm9maWxlIiwib3BlbmlkIiwiZW1haWwiXX0.PZ2reGhO0qpgIGf9mwfYwuXeRhVyh1t6u5oJaTeyoHwqCgz6emL-Vj7LMojHngdUcoFRL9pw5wpzPk0QAJGju9572e7SYQZ7UYbM_SiUn43fCIgXeGH9FG_v-WKnzlYCo9mRBdl2xq8VFQWjDU5H_acXm1SL94LrRiu2Wi2nAwsTmjWYY_x8ne_4yASJbny7045kIoV6X_Pa73jlX8VYB-7KOkcsMJlxJy4nOX-jrE7Suc1XZFQy9o9A4BUrSA72HOFqw3IeRugGaNjyXypN9lcXaSfF5xmk6bVoJT3Ciz6vChKSmVYYdV3sWJM0W24OdP1NigtXYH6WJZ-VnDbelQ
User-Agent: Drupal (+http:\drupal.org)
Host: dev-345757.oktapreview.com

Response ::
{
[12:58]
“data”: “\nRequest Error</TITLE>\n</HEAD>\n\n\n</strong></big>
\n</FONT>\n
\n\n
\n\nRequest Error (invalid_request)</big>\n
\n
\n</FONT>\n</TD></TR>\n
\n\nYour request could not be processed. Request could not be handled\n</FONT>\n</TD></TR>\n
\n\nThis could be caused by a misconfiguration, or possibly a malformed request.\n</FONT>\n</TD></TR>\n
\n\n
\nFor assistance, contact your network support team.\n</FONT>\n</TD></TR>\n</TABLE>\n</blockquote>\n</FONT>\n</BODY></HTML>\n”,
“protocol”: “HTTP/1.1”,
“status_message”: “Bad Request”,
“headers”: {
“cache-control”: “no-cache”,
“pragma”: “no-cache”,
“content-type”: “text/html; charset=utf-8”,
“connection”: “close”,
“content-length”: “691”
},
“code”: “400”,
“error”: “Bad Request”
[12:58]
}

Please help to solve the issue.