I am currently developing client-side Javascript code that will fork a specified GitHub repository. To achieve this, I am utilizing the OAuth.io service to obtain an OAuth token with the necessary API scopes of "public_repo" and "repo".
For accessing the GitHub API, I have incorporated the github.js library in my project. The core functionality lies within the usage of the fork
method within the makeWebsite
function:
$(document).ready(function() {
initializeOAuth();
setEventListener();
});
var setEventListener = function() {
$("#button").click(popupOAuth);
};
var initializeOAuth = function() {
OAuth.initialize("rG-ChpeD0zdiIPoJpK58gN4qMJQ");
};
var popupOAuth = function() {
OAuth.popup("github").done(makeWebsite);
};
var makeWebsite = function(result) {
var token = result["token"];
var github = new Github({
token: token,
auth: "oauth"
});
var repo = github.getRepo("michael", "github");
repo.fork(function(err) {
console.log(err);
});
};
Upon executing this script and successfully completing the OAuth authorization process, I encounter the following error message: