Error: Unable to exchange code for API access token. HTTP client error: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to keycloak-dev.examplel.com:443

I have integrated nextcloud with keycloak through social login app .

So firstly i’ll get a nextcloud login page after hitting my url, there i have a button named: login with keyclaok.
then it redirects me to the keycloak page, there i enter my credentials and after hitting to login i get the below error:

Unable to exchange code for API access token. HTTP client error: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to keycloak-dev.example.com:443 .

Kindly note:
i have 3 servers:
1st server: server where nextcloud is installed
2nd server: server where keycloak is installed
3rd server: Webserver where nextcloud and keycloak are hosted on NGINX

Nextcloud Version-27.1.3
Keycloak Version- 22.0.1