Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unable to Configure HTTPS Agent with Self-Signed Certificate in nest-keycloak-connect #196

Open
ALaa13 opened this issue Jan 15, 2025 · 0 comments
Labels
Status: Needs Investigation Needs to be investigated

Comments

@ALaa13
Copy link

ALaa13 commented Jan 15, 2025

I’m using nest-keycloak-connect to integrate Keycloak into my NestJS app, and I’ve hit a roadblock. My Keycloak server is set up with a self-signed certificate, and when the app tries to validate access tokens, I keep getting this error:

[Nest] 1 - 01/15/2025, 4:28:29 PM WARN [Keycloak] Cannot validate access token: Error: self-signed certificate

It looks like the library doesn’t trust the self-signed certificate, and I haven’t found an easy way to configure it to work. I’ve tried adding the realmPublicKey directly in the configuration, which I assumed would bypass SSL verification, but the issue persists.

KeycloakConnectModule.registerAsync({
  useFactory: () => ({
    authServerUrl: 'https://<your-keycloak-url>',
    realm: '<your-realm>',
    clientId: '<your-client-id>',
    secret: '<your-secret>',
    realmPublicKey: '<your-public-key>',
  }),
});

It would be super helpful if there was an option in the library to allow self-signed certificates (at least for dev setups) or better documentation on how to handle them.
Any chance of adding support for this or pointing me in the right direction? Let me know if more details are needed—happy to provide more info if it helps!

@ferrerojosh ferrerojosh added the Status: Needs Investigation Needs to be investigated label Jan 28, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Status: Needs Investigation Needs to be investigated
Projects
None yet
Development

No branches or pull requests

2 participants