|
|
|
@ -30,7 +30,7 @@ async function login(loginUrl, username, password, service) {
|
|
|
|
|
cache.put(`${tokenCacheKey}.${service}`, data.token, expiration - 5 * 60 * 1000); // expiration -5 minutes
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
logger.error(`Error ${status} logging into npm`, authResponse[2]);
|
|
|
|
|
logger.error(`Error ${status} logging into npm`, JSON.stringify(authResponse[2]));
|
|
|
|
|
}
|
|
|
|
|
return [status, data.token ?? data];
|
|
|
|
|
}
|
|
|
|
@ -50,7 +50,6 @@ export default async function npmProxyHandler(req, res) {
|
|
|
|
|
const loginUrl = `${widget.url}/api/tokens`;
|
|
|
|
|
|
|
|
|
|
let status;
|
|
|
|
|
let contentType;
|
|
|
|
|
let data;
|
|
|
|
|
|
|
|
|
|
let token = cache.get(`${tokenCacheKey}.${service}`);
|
|
|
|
@ -62,7 +61,7 @@ export default async function npmProxyHandler(req, res) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[status, contentType, data] = await httpProxy(url, {
|
|
|
|
|
[status, , data] = await httpProxy(url, {
|
|
|
|
|
method: "GET",
|
|
|
|
|
headers: {
|
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
@ -81,7 +80,7 @@ export default async function npmProxyHandler(req, res) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
|
|
[status, contentType, data] = await httpProxy(url, {
|
|
|
|
|
[status, , data] = await httpProxy(url, {
|
|
|
|
|
method: "GET",
|
|
|
|
|
headers: {
|
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
|