Skip to content

Client, how to ignore self signed SSL (skip-verify) ? #160

Answered by aikoven
jkristia asked this question in Q&A
Discussion options

You must be logged in to vote

I found one way to do it by overriding ConnectionOptions in ChannelCredentials to add rejectUnauthorized: false:

import {CallCredentials} from '@grpc/grpc-js';
import {ChannelCredentials, createChannel} from 'nice-grpc';
import {ConnectionOptions} from 'tls';

class InsecureSSLChannelCredentials extends ChannelCredentials {
  constructor(
    private parent: ChannelCredentials = ChannelCredentials.createSsl(),
  ) {
    super();
  }

  _getConnectionOptions(): ConnectionOptions | null {
    return {
      ...this.parent._getConnectionOptions(),
      rejectUnauthorized: false,
    };
  }
  compose(callCredentials: CallCredentials): ChannelCredentials {
    return new InsecureSSLChannelCre…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jkristia
Comment options

Answer selected by jkristia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants