Hello there, I'm at my wits end I'm struggling I would like to know where I'm going wrong I can't seem to get past this error connect ECONNREFUSED 127.0.0.1:443 something tells me it's something small that I'm neglecting but I can't see it. I read here that it's possible that the is a network overload problem but I have shut everything down except my ngrok to simulate https and the mongodb running yet still no joy. Any and all suggestions appreciated
const https = require('https');
app.get('/auth/instagram', (req, res) => {
const clientId = process.env.INSTAGRAM_ID;
const redirectUri = process.env.INSTAGRAM_ID_URI;
res.redirect(`https://api.instagram.com/oauth/authorize?client_id=${clientId}&redirect_uri=${redirectUri}&scope=user_profile,user_media&response_type=code`);
});
app.get('/auth/instagram/callback', (req, res) => {
// console.log('this is the code', req.query.code);
const { code } = req.query;
console.log('this is the code ', code);
const redirectURL = `${process.env.BASE_URL}/auth/instagram/callback`;
const url = 'https://api.instagram.com/oauth/access_token';
const options = {
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: {
client_id: process.env.INSTAGRAM_ID,
client_secret: process.env.INSTAGRAM_SECRET,
grant_type: 'authorization_code',
redirect_uri: redirectURL,
code
},
json: true,
url
};
console.log('This is that options', options);
https.request(options, (err, res) => {
console.log('this is the body', res);
});
process.on('uncaughtException', (err) => {
console.log(err);
});
});
Error
Error: connect ECONNREFUSED 127.0.0.1:443
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 443
}