Docs Menu
Docs Home
/
MongoDB Atlas
/ / /

์„œ๋น„์Šค ๊ณ„์ • ํ† ํฐ ์ƒ์„ฑ

์ด ํŽ˜์ด์ง€์˜ ๋‚ด์šฉ

  • Resource
  • ์š”์ฒญ ๊ฒฝ๋กœ ๋งค๊ฐœ๋ณ€์ˆ˜
  • ์š”์ฒญ ์ฟผ๋ฆฌ ๋งค๊ฐœ๋ณ€์ˆ˜
  • ์š”์ฒญ ๋ณธ๋ฌธ ๋งค๊ฐœ๋ณ€์ˆ˜
  • ์‘๋‹ต
  • ์š”์ฒญ ์˜ˆ์‹œ
  • ์‘๋‹ต ์˜ˆ์‹œ
  • ์‘๋‹ต ํ—ค๋”
  • ์‘๋‹ต ๋ณธ๋ฌธ

์„œ๋น„์Šค ๊ณ„์ •์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ Atlas ๊ด€๋ฆฌ API ์— ์š”์ฒญํ•˜๋ ค๋ฉด ํ† ํฐ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ํ•™์Šต ๋ณด๋ ค๋ฉด ์„œ๋น„์Šค ๊ณ„์ • ๊ฐœ์š”๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

POST https://cloud.mongodb.com/api/oauth/token

์ด ์—”๋“œํฌ์ธํŠธ๋Š” HTTP ์š”์ฒญ ๊ฒฝ๋กœ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ ์ฟผ๋ฆฌ ๋งค๊ฐœ๋ณ€์ˆ˜๋Š” ์„ ํƒ ์‚ฌํ•ญ์ž…๋‹ˆ๋‹ค.

์ด๋ฆ„
์œ ํ˜•
ํ•„์š”์„ฑ
์„ค๋ช…
๊ธฐ๋ณธ๊ฐ’
pretty
๋ถ€์šธ
์˜ต์…˜
์‘๋‹ต ๋ณธ๋ฌธ์ด ํ”„๋ฆฌํ‹ฐํ”„๋ฆฐํŠธ ์— ์žˆ์–ด์•ผ ํ•˜๋Š”์ง€ ์—ฌ๋ถ€๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ํ”Œ๋ž˜๊ทธ์ž…๋‹ˆ๋‹ค. ํ˜•์‹.
false
envelope
๋ถ€์šธ
์˜ต์…˜

์‘๋‹ต์„ ์—”๋ฒจ๋กœํ”„์— ๋ž˜ํ•‘ํ• ์ง€ ์—ฌ๋ถ€๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ํ”Œ๋ž˜๊ทธ์ž…๋‹ˆ๋‹ค.

์ผ๋ถ€ API ํด๋ผ์ด์–ธํŠธ๋Š” HTTP ์‘๋‹ต ํ—ค๋” ๋˜๋Š” ์ƒํƒœ ์ฝ”๋“œ์— ์•ก์„ธ์Šคํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋ ค๋ฉด ์ฟผ๋ฆฌ์—์„œ envelope : true๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

๊ฒฐ๊ณผ ๋ชฉ๋ก์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ์—”๋“œํฌ์ธํŠธ์˜ ๊ฒฝ์šฐ content ๊ฐ์ฒด ๋Š” ์—”๋ฒจ๋กœํ”„์ž…๋‹ˆ๋‹ค. Atlas ๊ฐ€ ์‘๋‹ต ๋ณธ๋ฌธ์— status ํ•„๋“œ ๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

false

์ด ์—”๋“œํฌ์ธํŠธ๋Š” HTTP ์š”์ฒญ ๋ณธ๋ฌธ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์‘๋‹ต์—๋Š” ๋‹ค์Œ์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.

์ด๋ฆ„
์œ ํ˜•
์„ค๋ช…
access_token
๋ฌธ์ž์—ด
API ์š”์ฒญ ์ธ์ฆ์„ ์œ„ํ•œ ์„œ๋น„์Šค ๊ณ„์ • ์•ก์„ธ์Šค ํ† ํฐ์ž…๋‹ˆ๋‹ค.
token_type
๋ฌธ์ž์—ด
ํ† ํฐ ๊ถŒํ•œ ๋ถ€์—ฌ ๋ฉ”์ปค๋‹ˆ์ฆ˜์œผ๋กœ, ์—ฌ๊ธฐ์„œ๋Š” Bearer ๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.
expires_in
integer
์•ก์„ธ์Šค ํ† ํฐ์ด ์œ ํšจํ•œ ๊ธฐ๊ฐ„(์ดˆ)์ž…๋‹ˆ๋‹ค.

๋‹ค์Œ ์˜ˆ์‹œ ์—์„œ {BASE64-AUTH} ์„ ๊ธฐ๋ณธ64์ธ์ฝ”๋”ฉ๋œ ์„œ๋น„์Šค ๊ณ„์ • ํด๋ผ์ด์–ธํŠธ ID ๋ฐ ์‹œํฌ๋ฆฟ์œผ๋กœ ๋ฐ”๊ฟ‰๋‹ˆ๋‹ค. ํ•™์Šต ๋‚ด์šฉ ์€ API ์š”์ฒญํ•˜๊ธฐ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

curl --request POST \
--url https://cloud.mongodb.com/api/oauth/token \
--header 'accept: application/json' \
--header 'cache-control: no-cache' \
--header 'authorization: Basic {BASE64-AUTH}' \
--header 'content-type: application/x-www-form-urlencoded' \
--data 'grant_type=client_credentials'
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}
X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
HTTP/1.1 400 Bad Request
Date: {dateInUnixFormat}
Content-Type: application/json
Content-Length: {requestLengthInBytes}
Server: mdbws
Strict-Transport-Security: max-age=31536000; includeSubdomains;
X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
...
HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=ISO-8859-1
Date: {dateInUnixFormat}
WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false
Content-Length: {requestLengthInBytes}
Connection: keep-alive
HTTP/1.1 403 Forbidden
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}
X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
...
HTTP/1.1 429 Too Many Requests
Retry-After: {retryAfterValue}
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}
X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
...
HTTP/1.1 500 Internal Server Error
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Content-Length: {requestLengthInBytes}
X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
...
HTTP/1.1 503 Service Unavailable
Retry-After: {retryAfterValue}
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Content-Length: {requestLengthInBytes}
X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
...
{
"access_token":"eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCIsImtpZCI6IjAwMDAwMDAwLTQwMDBtLTQ0MGEIXkY0IH4IMF84MGYMX2FtperB2miniFzHCJ9.eyJpc3MiOiJodHRwczUvYWxkZXYubW9uZ29kYi5jb20iLCJhdWQiOiJhcGk6Ly9hZG1pbiIsInN1YiI6ImZha2Vfc3ViX2lkXzAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwIiwic2lkIjoiZmFrZTNfaWRfMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwIiwic2Vzc2lvblN1YiI6ImZha2Vfc2lkXzAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwIIDmVlc1NX4adGVyaCBJRCJvbmcxISS8zdeD0pyQwMjNlIiwiYWN0b3JJZCI6ImZha2Vfc2lkXzAwMDAwMDAwMDAwMDOIi8wMDAwMDAwMCIsImlhdCI6MTIzNDU2Nzg5MCwiZXhwIjoxMjM0NTc0OTgwLCJqdGkiOiJmYWtlLWp0aS02MOwNDBQNDBdDOGhyES8xOTY1OGEtMDAwMDAwMDAwMDAwMDAwMDAwMGIwNjRGM3NifQ==.jmbo9d_fgfk32FGB423f09SF0kFSDFoQxh3j9FZ2",
"expires_in":3600,
"token_type":"Bearer"
}
{
"error_description": "The provided credentials are not valid.",
"error": "invalid_request"
}
{
"error_description": "Invalid grant type.",
"error": "unsupported_grant_type"
}
{
"error_description": "Invalid grant.",
"error": "invalid_grant"
}
{
"error_description": "Invalid credentials provided.",
"error": "invalid_client"
}
{
"error_description": "IP access list validation failed for the service account.",
"error": "access_denied"
}
{
"error_description": "Resource {URL} is limited to 10 requests every 1 minutes.",
"error": "rate_limited"
}
{
"error_description": "Unexpected error.",
"error": "server_error"
}

๋Œ์•„๊ฐ€๊ธฐ

์‚ฌ์šฉ์ž ์ง€์ • ์—ญํ•  ์กฐ์น˜