<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z000073Dft3CACOkta Classic EngineIntegrationsAnswered2021-07-10T15:03:18.000Z2021-07-06T18:46:06.000Z2021-07-10T15:03:18.000Z

KevinW.91496 (Customer) asked a question.

Node.js - Error when using custom login domain

Language: Node.js + Express

 

After implementing a custom login domain using the instructions here (https://developer.okta.com/docs/guides/custom-url-domain/update-other-okta-settings/) and updating each app settings to use the new domain, the last step was to update the "issuer" field when defining the OpenID Connect client in my node.js application. When doing that, I get the following error:

 

UnhandledPromiseRejectionWarning: RequestError: unable to verify the first certificate

  at ClientRequest.<anonymous> (C:\Users\*****\node_modules\got\source\request-as-event-emitter.js:178:14)

  at Object.onceWrapper (events.js:422:26)

  at ClientRequest.emit (events.js:327:22)

  at ClientRequest.origin.emit (C:\Users\****\node_modules\@szmarczak\http-timer\source\index.js:37:11)

  at TLSSocket.socketErrorListener (_http_client.js:469:9)

  at TLSSocket.emit (events.js:315:20)

  at emitErrorNT (internal/streams/destroy.js:106:8)

  at emitErrorCloseNT (internal/streams/destroy.js:74:3)

  at processTicksAndRejections (internal/process/task_queues.js:80:21)

 

The certificate is valid and if I access the custom domain URL via the browser there is no certificate error. If I return the issuer field back to the default, the error goes away. The only way I can get the application to use the custom URL is to add the environmental variable "NODE_TLS_REJECT_UNAUTHORIZED" = 0, which isn't safe long term for many reasons.

 

Any advice would be appreciated!


  • Radu (Okta, Inc)

    Hello Kevin,

     

    This error can appear when the certificate used to create the custom domain does not contain an entire certificate chain. Try recreating the certificate and adding the entire chain, including the CA's root certificate.

    If you still require assistance, please reach out to our Developer team on https://devforum.okta.com/

     

    Thank You,

     

    Radu Chiriac

    Technical Support Engineer

    Okta Global Customer Care

    Expand Post
    Selected as Best
  • Radu (Okta, Inc)

    Hello Kevin,

     

    This error can appear when the certificate used to create the custom domain does not contain an entire certificate chain. Try recreating the certificate and adding the entire chain, including the CA's root certificate.

    If you still require assistance, please reach out to our Developer team on https://devforum.okta.com/

     

    Thank You,

     

    Radu Chiriac

    Technical Support Engineer

    Okta Global Customer Care

    Expand Post
    Selected as Best
  • KevinW.91496 (Customer)

    Hi @Radu (Okta, Inc)​ ,

     

    Adding the full chain of the cert worked. Thank you for you help!

     

    Kevin

This question is closed.
Loading
Node.js - Error when using custom login domain