Friday 21 April 2017

What can we use instead of these rejectUnauthorized: false, requestCert: true in React Native?

I am calling a remote API that is working on postman on windows platform but the same is not working on IOS platform in postman.

I have to call that API in React-Native but I am getting error Network Request failed on IOS.

I have developed the node Js call and it is working here also but I had to submit these two parameters, these are rejectUnauthorized: false, requestCert: true,

Here is my Code that is working in NODE.JS but not in React-Native.

var r = request.post('HTTPS://{HOST}/oauth2-api/p/v1/token?scope=TMO_ID_profile associated_billing_accounts associated_customers associated_lines billing_information offer' +
    '&grant_type=client_credentials', {
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
            'Authorization': '{BASIC BASE 64}'
        },
        rejectUnauthorized: false,
        requestCert: true,
    },
    function optionalCallback(err, httpResponse, body) {
        if (err) {
            return console.error(' failed:', err);
        }

          console.log(' Server responded with:', JSON.parse(body));
          requestaccess(JSON.parse(body).token_type + " " + JSON.parse(body).access_token);

    });

Only concern is what is the alternative of these two
rejectUnauthorized: false, requestCert: true, in React-Native?



via ram

No comments:

Post a Comment