MongoDB Atlas로 인증합니다.
이 명령을 사용하면 사용자 계정, 서비스 계정 또는 API 키 인증 방법을 사용하여 MongoDB Atlas 로 인증할 수 있습니다.
사용자 계정 로그인은 로컬 콜백 서버와 함께 권한 부여 코드 및 PKCE 흐름을 사용합니다. 대신 더 이상 사용되지 않는 장치 코드 흐름을 사용하려면 atlas auth login --authType=UserAccountLegacy --output plaintext을(를) 실행하세요.
참고: 환경 변수에 자격 증명이 설정되어 있는 경우, 인증 중에 제공하는 값보다 우선합니다. 자세한 내용은 https://www.mongodb.com/ko-kr/docs/atlas/cli/current/atlas-cli-env-variables/#precedence.를 참조하세요.
비대화형으로 로그인하려면 --authType, --output 및 해당 유형에 필요한 자격 증명 플래그(--clientId 및 --clientSecret(ServiceAccount의 경우) 또는 --publicApiKey 및 --privateApiKey(APIKeys의 경우))를 설정합니다. 이러한 플래그 중 하나를 흐름을 완료하는 데 필요한 다른 플래그 없이 사용하면 프롬프트가 표시되는 대신 오류가 반환됩니다.
--orgId 또는 --projectId가 없는 경우, 자격 증명이 단 하나의 조직이나 프로젝트에만 액세스할 수 있을 때만 기본값이 저장됩니다.
구문
명령 구문
atlas auth login [options]옵션
이름 | 유형 | 필수 사항 | 설명 |
|---|---|---|---|
--authType | 문자열 | 거짓 | 사용할 인증 유형입니다. 유효한 값은 UserAccount, UserAccountLegacy, ServiceAccount 또는 APIKeys입니다. 설정된 경우 인증 유형 프롬프트를 건너뜁니다. |
--clientId | 문자열 | 거짓 | 서비스 계정 클라이언트 ID입니다. --clientSecret, --authType 및 --output과 함께 설정해야 합니다. 모두 설정된 경우 자격 증명 프롬프트를 건너뜁니다. |
--clientSecret | 문자열 | 거짓 | 서비스 계정 클라이언트 시크릿입니다. --clientId, --authType 및 --output과 함께 설정해야 합니다. 모두 설정된 경우 자격 증명 프롬프트를 건너뜁니다. |
--gov | 거짓 | 정부용 Atlas에 로그인합니다. | |
-h, --help | 거짓 | 로그인 도움말 | |
--noBrowser | 거짓 | 브라우저 세션을 자동으로 열지 않습니다. | |
--orgId | 문자열 | 거짓 | 프로필 기본값으로 저장할 조직 ID입니다. 설정하면 조직 프롬프트를 건너뜁니다. |
-o, --output | 문자열 | 거짓 | 프로필에 저장할 기본값 출력 형식입니다. 유효한 값은 plaintext 또는 json입니다. 설정하면 출력 형식 프롬프트를 건너뜁니다. |
--privateApiKey | 문자열 | 거짓 | 비공개 API 키입니다. --publicApiKey, --authType 및 --output과 함께 설정해야 합니다. 모두 설정된 경우 자격 증명 프롬프트를 건너뜁니다. |
--projectId | 문자열 | 거짓 | 프로필 기본값으로 저장할 프로젝트 ID입니다. 설정하면 프로젝트 프롬프트를 건너뜁니다. |
--publicApiKey | 문자열 | 거짓 | 공개 API 키입니다. --privateApiKey, --authType 및 --output과 함께 설정해야 합니다. 모두 설정된 경우 자격 증명 프롬프트를 건너뜁니다. |
상속된 옵션
이름 | 유형 | 필수 사항 | 설명 |
|---|---|---|---|
-P, --profile | 문자열 | 거짓 | 구성 파일 에서 사용할 프로필의 이름입니다. Atlas CLI 의 프로필에 대해 학습 https://dochub.mongodb.org/core/atlas-cli-save-connection-settings를 참조하세요. |
예시
# Log in to your MongoDB Atlas account in interactive mode:atlas auth login# Log in non-interactively with a Service Account:atlas auth login --authType ServiceAccount --clientId <clientId> --clientSecret <clientSecret> --output plaintext# Log in non-interactively with a Service Account and store the default organization and project:atlas auth login --authType ServiceAccount --clientId <clientId> --clientSecret <clientSecret> --output plaintext --orgId <orgId> --projectId <projectId># Log in non-interactively with API Keys:atlas auth login --authType APIKeys --publicApiKey <publicApiKey> --privateApiKey <privateApiKey> --output plaintext