2016-01-19 27 views
0

我見過instagram-api-unable-to-reach-callback-url。 這沒有幫助。 我想訂閱用戶nodejs和instagram節點我越來越400 - 無法達到回調URL

的授權工作正常,它調用我的回調成功 (REDIRECT_URI = http://home.mydomain.me:8889/handleauth),我得到一個result.access_token

exports.handleauth = function(req, res) { 
    api.authorize_user(req.query.code, redirect_uri, function(err, result) { 
    if (err) { 
     console.log(err.body); 
     res.send("Didn't work"); 
    } else { 
     console.log('Yay! Access token is ' + result.access_token); 
     res.send('You made it!!'); 
    } 
    }); 
}; 

但是當我嘗試訂購電話,我得到

{ 「代碼」:400, 「ERROR_TYPE」: 「APISubscriptionError」, 「ERROR_MESSAGE」: 「無法 達到回調URL \」 http://home.mydomain.me:8889/newpost \ 「」}

exports.subscribe2= function(req, res, next) { 

var headers = { 
    'User-Agent':  'Super Agent/0.0.1', 
    'Content-Type':  'application/x-www-form-urlencoded' 
} 
var options = { 
    url: 'https://api.instagram.com/v1/subscriptions/', 
    method: 'POST', 
    headers: headers, 
    form: {'client_id': 'myclientid' 
      , 'client_secret': 'myclientsecret' 
      , 'object': 'user' 
      , 'aspect': 'media' 
      , 'verify_token': myAccessToken from result.access_token above 
      , 'callback_url': 'http://home.mydomain.me:8889/newpost' 
      } 
}; 

request(options, function (error, response, body) { 
    if (!error && response.statusCode == 200) { 
     // Print out the response body 
     console.log(body) 
     res.send(body); 
    } else{ 
     console.log(error) 
     res.send(body); 
    } 
}) 

}; 

我知道它可用的URL。我可以通過我的瀏覽器去http://home.mydomain.me:8889/newpost。我也訪問的URL從https://www.site24x7.com/check-website-availability.html

感謝任何幫助/建議

回答

0

的方式我得到這個工作是讓我的回調使用https,而不是http