-
Notifications
You must be signed in to change notification settings - Fork 15
Support multiple values for githubOrg #38
Comments
Any news on this? I'm not aware of all the changes needed in npm enterprise to support this, but to implement it here we can simply query all the orgs until the user is authenticated in one of them, like (credits to @xaka). authenticator.js (line 84) }).then(_this.githubOrg && function(token) {
return Promise.any([].concat(_this.githubOrg).map(function (githubOrg) {
return new Promise(function(resolve, reject) {
github.orgs.getMember({ user: username, org: githubOrg }, function(err, res) {
if (err) reject(err);
else resolve(token);
});
});
})).catch(function(err) {
// handle possible AggregateError, which is a collection of promise errors
err = err instanceof Promise.AggregateError ? err[0] : err;
if (err.code === 404) {
err.code = 401;
err.message = 'unauthorized';
} else if (err.code === 500) {
err.message = 'GitHub enterprise unavailable';
}
// this is an error state
throw err;
});
});
}; To support either an
But I'm not sure if this is the right place to do it. If so, the line should be added above the |
@nanovazquez in my QA; #39 doesn't seem to quite do the trick, because at publish time it gets an invalid org error, caused by: https://github.com/npm/npme-auth-github/blob/master/authorizer.js#L83 I think it should be a pretty quick fix; if you get to it before me I can land the feature ASAP. |
@nanovazquez I just released a new version of npm Enterprise with support for multiple organizations (via your patch); please let me know if this does the trick for you. |
@bcoe: Does this version contain the fix? |
@nanovazquez yes! let me know if you run into any issues. |
@bcoe: Worked! Thanks for taking care of this :) |
For the benefit of npm Enterprise, it should probably accept both an array and a string value that can be parsed into multiple values.
The text was updated successfully, but these errors were encountered: