"What could be the reason for encountering a 'Socket Hang Up' error when dealing with OAuth 2.0 Redirect URL Issue in a React App and Node.js Backend, despite successfully receiving a response in Postman, especially when using Node.js POST method?"
I'm currently working on implementing OAuth 2.0 in my React application for user authorization, with a Node.js backend serving as a proxy server for API calls to the authentication provider. However, after a successful login on the authorization server's page, the redirect URL specified in my Node.js configuration isn't generating a token, and I'm encountering a "socket hang up" error.
I've tried to address this issue by configuring my Node.js server to use HTTPS and adding certificates. Here's my configuration:
REACT_APP_SERVER_URL = https://127.0.0.1:55555
REDIRECT_URI = http://127.0.0.1:55555/login
In the documentation for my OIDC authorization code flow, I've come across the requirement that "The Client must validate the server’s identity based on the server's TLS certificate." I am following this recommendation, but the issue persists.
I cant change REDIRECT_URI to use HTTPS manually by using https://127.0.0.1:55555/login
Can anyone provide guidance on how to resolve this issue and ensure successful token generation after a successful login?
What I have tried:
const response = await axios.post(tokenEndpoint, tokenRequestParams.toString(), {
headers: {
Authorization: Authorization,
'Content-Type': 'application/x-www-form-urlencoded'
}