From 171fb357cb8140698b38637c5cfb42d2d445ab5d Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Tue, 2 Jan 2024 13:44:33 +0300 Subject: [PATCH] simplify npm authentication --- jfrog-oauth/run.sh | 8 +------- jfrog-token/run.sh | 8 +------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/jfrog-oauth/run.sh b/jfrog-oauth/run.sh index 3456d72..376e27b 100644 --- a/jfrog-oauth/run.sh +++ b/jfrog-oauth/run.sh @@ -30,13 +30,7 @@ else email=${ARTIFACTORY_EMAIL} registry=${JFROG_URL}/artifactory/api/npm/${REPOSITORY_NPM} EOF - # if npm version is greater than or equal to 9.0.0, use the new .npmrc format - if [ "$(npm --version | cut -d. -f1)" -ge 9 ]; then - echo "//${JFROG_HOST}/artifactory/api/npm/${REPOSITORY_NPM}/:_authToken=${ARTIFACTORY_ACCESS_TOKEN}" >> ~/.npmrc - else - echo "_auth=$(echo -n '${ARTIFACTORY_USERNAME}:${ARTIFACTORY_ACCESS_TOKEN}' | base64)" >> ~/.npmrc - echo "always-auth=true" >> ~/.npmrc - fi + echo "//${JFROG_HOST}/artifactory/api/npm/${REPOSITORY_NPM}/:_authToken=${ARTIFACTORY_ACCESS_TOKEN}" >> ~/.npmrc fi # Configure the `pip` to use the Artifactory "python" repository. diff --git a/jfrog-token/run.sh b/jfrog-token/run.sh index 88968c2..627d856 100644 --- a/jfrog-token/run.sh +++ b/jfrog-token/run.sh @@ -30,13 +30,7 @@ else email=${ARTIFACTORY_EMAIL} registry=${JFROG_URL}/artifactory/api/npm/${REPOSITORY_NPM} EOF - # if npm version is greater than or equal to 9.0.0, use the new npmrc format - if [ "$(npm --version | cut -d. -f1)" -ge 9 ]; then - echo "//${JFROG_HOST}/artifactory/api/npm/${REPOSITORY_NPM}/:_authToken=${ARTIFACTORY_ACCESS_TOKEN}" >> ~/.npmrc - else - echo "_auth=$(echo -n '${ARTIFACTORY_USERNAME}:${ARTIFACTORY_ACCESS_TOKEN}' | base64)" >> ~/.npmrc - echo "always-auth=true" >> ~/.npmrc - fi + echo "//${JFROG_HOST}/artifactory/api/npm/${REPOSITORY_NPM}/:_authToken=${ARTIFACTORY_ACCESS_TOKEN}" >> ~/.npmrc fi # Configure the `pip` to use the Artifactory "python" repository.