How to get github token using username and password

Viewed 27085

I am developing mobile apps using rhodes. I want to access private repo of github. I am having only username and password.

How to get token of given username and password.

6 Answers

Here is the code to use GitHub Basic Authentication in JavaScript

let username = "*******";
    let password = "******";
    let auth = "Basic " + new Buffer(username + ":" + password).toString("base64");
    
    var options = {
        host: 'api.github.com',
        path: '/search/repositories?q=google%20maps%20api',
        method: 'GET',
        headers: {
                'user-agent': 'node.js',
                "Authorization": auth
                 }
                 };
    var request = https.request(options, function (res) {
                  }));
Related