-
npm repository 사용시 인증(로그인) 처리 방법설치&설정 관련 2022. 10. 17. 14:54728x90
npm repository 사용시 인증(로그인) 처리 방법
Nexus 설치 및 설정을 후 보안의 사유로 계정 로그인 처리를 찾아보다 .npmrc파일에 _auth를 이용해서 로그인 처리를 알게 되었습니다.
.npmrc 파일은 아래와 같은 key를 가지고 있습니다.
# Nexus proxy registry pointing to http://registry.npmjs.org/ registry = https://<host>/nexus/content/repositories/npmjs-registry/ # base64 encoded authentication token _auth = <see question below> # required by Nexus email = <valid email> # force auth to be used for GET requests always-auth = true # we don't want to put certificates in .npmrc strict-ssl = false # log level - Logging Level은 error / warn / info / http / verbose / debug / silly 로 오른쪽으로 갈 수록 많이 표기 됩니다. loglevel = silly
.npmrc 에서 base64로 계정 정보(ID/PW)를 이용한 Token을 _auth에 넣으면 자동으로 로그인이 됩니다.
base64를 이용한 Token 생성방법은 아래와 같습니다.
$ echo -n 'username:password' | openssl base64
결과 값을 _auth에 삽입 후 npm install을 명령어를 이용하면 로그인이 자동으로 처리 되어서 편리합니다.
참고자료
728x90'설치&설정 관련' 카테고리의 다른 글
XWIKI 첨부파일 확장자 확인 후 업로드 처리 (0) 2022.10.20 Window에서 스케쥴 처리(crontab) (0) 2022.10.18 XWIKI 팁 정리 (0) 2022.10.14 MacOS(monterey) USB 테더링 by android (0) 2022.10.05 sar 툴 설치 하기 (0) 2021.12.29