Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit a4c6a31

Browse files
Capturing response for enterprise workaround
As per #621 we are treating the 422 status code as a signal that the password should be used as the token.
1 parent 8b9740d commit a4c6a31

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

octorun/src/authentication.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,14 @@ var handleAuthentication = function (username, password, onSuccess, onFailure, t
3131
client_secret: config.clientSecret,
3232
headers: headers
3333
}, function (err, res) {
34+
35+
console.log("octokit.authorization.create", typeof(err), err, res);
3436
if (err) {
35-
if (twoFactorRegex.test(err.message)) {
37+
if (twoFactor && err.code && err.code === 422) {
38+
//Two Factor Enterprise workaround
39+
onSuccess(password);
40+
}
41+
else if (twoFactorRegex.test(err.message)) {
3642
onSuccess(password, "2fa");
3743
}
3844
else if (lockedRegex.test(err.message)) {

0 commit comments

Comments
 (0)