Skip to content
Prev Previous commit
Next Next commit
fix
  • Loading branch information
cometkim committed Sep 17, 2025
commit 54d1528bde76f937dddbf74e8af1548cebf2385a
11 changes: 6 additions & 5 deletions packages/plugin-npm/sources/npmHttpUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,17 +466,18 @@ async function getAuthenticationHeader(registry: string, {authType = AuthType.CO
return `Basic ${npmAuthIdent}`;
}

if (mustAuthenticate && authType !== AuthType.BEST_EFFORT) {
throw new ReportError(MessageName.AUTHENTICATION_NOT_FOUND, `No authentication configured for request`);

} else if (allowOidc && ident) {
if (allowOidc && ident) {
const oidcToken = await getOidcToken(registry, {configuration, ident});
if (oidcToken) {
return `Bearer ${oidcToken}`;
}
}

return null;
if (mustAuthenticate && authType !== AuthType.BEST_EFFORT) {
throw new ReportError(MessageName.AUTHENTICATION_NOT_FOUND, `No authentication configured for request`);
} else {
return null;
}
}

function shouldAuthenticate(authConfiguration: MapLike, authType: AuthType) {
Expand Down