My task is to query GitHub for all open pulls, but I'm new to this and don't have anyone to turn to for guidance. The only resources I've found so far are the documentation on .
I came across a solution on that explains how to provide a username and password. However, I encountered an issue with GitHub's two-factor authentication.
After reading through the GitHub documentation, I found this note:
In addition to the Basic Authentication credentials, you must send the user's authentication code (i.e., one-time password) in the X-GitHub-OTP header.
To solve this, I generated a personal access token and adjusted my code like so:
const auth = getAuth();
$.ajax({
type: "GET",
url: "https://api.github.com/repos/company/repo/pulls",
dataType: 'json',
async: true,
headers: {
"Authorization": "Basic " + auth,
"X-GitHub-OTP": "d......Access...Token.......5"
},
...
However, I keep receiving a fail message with the following error:
Must specify two-factor authentication OTP code.
I thought I included the OTP code in the header, but it seems there's still an issue. I'm not sure where I've gone wrong.