React-native fetch() from https server with self-signed certificate

前端 未结 7 1293
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-30 01:39

I\'m trying to communicate with https server having self-signed certificate.

I can do this from .NET application (using ServicePointManager.ServerCertificateValidati

7条回答
  •  余生分开走
    2020-11-30 02:15

    This is happened due to self signed certificate used for encryption.Due to security reasons in android it demands C A authority signed or trusted certificates

    use this plugin to avoid this.

    https://www.npmjs.com/package/react-native-fetch-blob

    RNFetchBlob.config({
      trusty : true
    })
    .then('GET', 'https://xxxxx.com')
    .then((resp) => {
      // ...
    })
    

    Add config trusty as true to trust the certificate when you POST or GET API's

提交回复
热议问题