Skip to content Skip to sidebar Skip to footer

Request Forbidden While Accessing Github Api On Node.js Program

I'm trying to run this code but getting this error: Request forbidden by administrative rules, make sure your request has a User-Agent header var https = require('https'); var us

Solution 1:

Your options object does not have the headers option, describing the user-agent. Try this:

var options = {
    host: 'api.github.com',
    path: '/users/' + username + '/repos',
    method: 'GET',
    headers: {'user-agent': 'node.js'}
};

Post a Comment for "Request Forbidden While Accessing Github Api On Node.js Program"