Issue
I am trying to implement an authentication mechanism using Keycloak to my nodejs application which is running on https port 4443 (https://localhost:4443
).
The Keycloak application is running in the EC2 instance in port 8443 https. I am trying to login to my application which is using Keycloak for authentication which is running on port 4443. But getting the below error:
Keycloak json file:
{
"realm": "VideoKYC-Realm",
"auth-server-url": "https://31.19.1.85:8443/auth",
"ssl-required": "external",
"resource": "VideoKYC",
"public-client": true,
"confidential-port": 0
}
Below is the settings made in the keycloak server
I dont have an SSL certificate as of now, so would need a way to bypass SSL. Additionally I tried to run keycloack on port 8080, i was not able to access the keycloak via browser.
However in the aws security group have allowed all the traffic as of now.
I am using the below image to run Keycloak in the EC2 instance. https://hub.docker.com/r/jboss/keycloak
Would request all of your help with this issue
Solution
You can use:
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
to instruct Node js to disable TLS certificate verification - https://nodejs.org/api/cli.html#cli_node_tls_reject_unauthorized_value
Of course that is not a production setup, because it will sacrifice TLS security.
Another options (probably more complicated):
- add used CA cert to your Node JS CA certs
- maybe used keycloak lib has config to disable TLS verification on the lib level
Answered By - Jan Garaj