Looker API로 작업을 수행하려면 먼저 인증해야 합니다. 취해야 할 단계는 SDK 사용 여부에 따라 다릅니다.
SDK를 사용한 인증
다음은 API 인증에 권장되는 방법입니다.
Looker 인스턴스의 관리 섹션에 있는 사용자 페이지에서 API 사용자 인증 정보를 만듭니다. Looker 관리자가 아닌 경우 Looker 관리자에게 API 사용자 인증 정보를 생성해 달라고 요청하세요.
API 사용자 인증 정보는 항상 Looker 사용자 계정에 결합됩니다. API 요청은 API 사용자 인증 정보와 연결된 '사용자로서' 실행됩니다. API 호출은 사용자가 볼 수 있는 데이터만 반환하고 사용자가 수정할 수 있는 항목만 수정합니다.
생성한 API 사용자 인증 정보에는 클라이언트 ID와 클라이언트 보안 비밀번호가 포함됩니다. 이러한 정보를 SDK에 제공해야 합니다. 이를 위한 안내는 SDK 문서에서 확인할 수 있습니다.
그러면 SDK가 필요한 액세스 토큰을 가져와서 이후의 모든 API 요청에 삽입합니다.
SDK 없이 인증
SDK를 사용한 API 인증을 사용하는 것이 좋습니다. SDK 없이 인증하려면 다음 안내를 따르세요.
Looker 인스턴스의 관리 섹션에 있는 사용자 페이지에서 API 사용자 인증 정보를 만듭니다. Looker 관리자가 아닌 경우 Looker 관리자에게 API 사용자 인증 정보를 생성해 달라고 요청하세요.
API 사용자 인증 정보는 항상 Looker 사용자 계정에 결합됩니다. API 요청은 API 사용자 인증 정보와 연결된 '사용자로서' 실행됩니다. API 호출은 사용자가 볼 수 있는 데이터만 반환하고 사용자가 수정할 수 있는 항목만 수정합니다.
API의 login 엔드포인트를 호출하여 단기 OAuth 2.0 액세스 토큰을 가져옵니다. 1단계에서 생성한 API 사용자 인증 정보(클라이언트 ID 및 클라이언트 보안 비밀번호 포함)를 제공해야 합니다.
이 액세스 토큰을 Looker API 요청의 HTTP 승인 헤더에 배치합니다. 승인 헤더가 있는 Looker API 요청의 예시는 다음과 같습니다.
GET /api/4.0/user HTTP/1.1
Host: test.looker.com
Date: Wed, 19 Oct 2023 12:34:56 -0700
Authorization: token mt6Xc8jJC9GfJzKBQ5SqFZTZRVX8KY6k49TMPS8F
OAuth 2.0 액세스 토큰은 logout 엔드포인트를 호출하여 액세스 토큰이 만료되거나 무효화될 때까지 여러 API 요청에 사용할 수 있습니다. 만료된 액세스 토큰을 사용하는 API 요청은 401 Authorization Required HTTP 응답과 함께 실패합니다.
사용자 로그인 설정과 API 상호작용
Looker API 인증은 Looker 사용자 로그인과 완전히 독립적입니다. 일회용 비밀번호(OTP, 2FA) 및 디렉터리 인증(LDAP, SAML 등)과 같은 사용자 인증 프로토콜은 Looker API 인증에 적용되지 않습니다.
따라서 사용자 인증 프로토콜에서 사용자 정보를 삭제해도 API 사용자 인증 정보는 삭제되지 않습니다. 개인 사용자 정보 삭제 문서 페이지의 절차를 사용하면 사용자의 모든 개인 정보가 Looker에서 삭제되고 사용자가 API를 통한 로그인을 포함하여 전혀 로그인할 수 없게 됩니다.
API 사용자 인증 정보 관리
여러 API 사용자 인증 정보 세트를 단일 Looker 사용자 계정에 결합할 수 있습니다.
API 사용자 인증 정보는 사용자 계정의 상태에 영향을 주지 않고 만들고 삭제할 수 있습니다.
Looker 사용자 계정을 삭제하면 사용자 계정에 결합된 모든 API 사용자 인증 정보가 무효화됩니다.
API 클라이언트 보안 비밀번호는 비공개로 유지해야 합니다. API 클라이언트 보안 비밀번호를 많은 사람이 볼 수 있는 소스 코드나 다른 위치에 저장하지 마세요.
프로덕션에서 Looker 관리자 계정에 바인딩된 API 사용자 인증 정보를 사용하지 마세요. 특히 API 활동('서비스 계정'이라고도 함) 전용의 최소 권한 사용자 계정을 만들고 이러한 계정에 API 사용자 인증 정보를 만듭니다.
의도한 API 활동에 필요한 권한만 부여합니다.
HTTPS 인증
클라이언트 SDK를 사용하여 인증 세부정보를 관리하는 경우에도 Looker API 인증이 어떻게 작동하는지 궁금할 수 있습니다. 인증에 관한 하위 수준의 세부정보는 GitHub의 Looker API 인증 방법을 참고하세요.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-12-22(UTC)"],[],[],null,["# Looker API authentication\n\n| **Note:** As of Looker 22.4, the [Looker API 4.0 is generally available](/looker/docs/api-4-ga). In Looker 23.18, the [Looker API 3.1 has been removed](/looker/docs/api-3x-deprecation).\n\nTo do anything with the Looker API, you'll first need to authenticate to it. The steps you'll need to take depend on whether or not you're using an SDK.\n\n\nAuthentication with an SDK\n--------------------------\n\nThis is the recommended method for API authentication:\n\n1. Create API credentials on the [Users page](/looker/docs/admin-panel-users-users) in the Admin section of your Looker instance. If you're not a Looker admin, ask your Looker admin to create the API credentials for you.\n\n API credentials are always bound to a Looker user account. API requests execute \"as\" the user associated with the API credentials. Calls to the API will only return data that the user is allowed to see, and modify only what the user is allowed to modify.\n2. The API credentials that you generated include a client ID and a client secret. You'll need to provide these to the SDK. The instructions for doing so can be found in the [SDK documentation](/looker/docs/api-sdk).\n\nThe SDK will then take care of obtaining the necessary access tokens and inserting them into all subsequent API requests.\n\n\nAuthentication without an SDK\n-----------------------------\n\nAPI authentication with an SDK is the recommended method. To authenticate without an SDK:\n\n1. Create API credentials on the [Users page](/looker/docs/admin-panel-users-users) in the Admin section of your Looker instance. If you're not a Looker admin, ask your Looker admin to create the API credentials for you.\n\n API credentials are always bound to a Looker user account. API requests execute \"as\" the user associated with the API credentials. Calls to the API will only return data that the user is allowed to see, and modify only what the user is allowed to modify.\n2. Obtain a short-term, OAuth 2.0 access token by calling the [`login`](/looker/docs/reference/looker-api/latest/methods/ApiAuth/login) endpoint of the API. You'll need to provide the API credentials that you generated in step 1, which include a client ID and a client secret.\n\n3. Place that access token into the HTTP authorization header of Looker API requests. An example Looker API request with an authorization header might look like this:\n\n GET /api/4.0/user HTTP/1.1\n Host: test.looker.com\n Date: Wed, 19 Oct 2023 12:34:56 -0700\n Authorization: token mt6Xc8jJC9GfJzKBQ5SqFZTZRVX8KY6k49TMPS8F\n\nThe OAuth 2.0 access token can be used on multiple API requests, until the access token expires or is invalidated by calling the [`logout`](/looker/docs/reference/looker-api/latest/methods/ApiAuth/logout) endpoint. API requests that use an expired access token will fail with a `401 Authorization Required` HTTP response.\n\nAPI interaction with user login settings\n----------------------------------------\n\nLooker API authentication is completely independent of Looker user login. User authentication protocols such as one-time passcodes (OTP, 2FA) and directory authentication (LDAP, SAML, and so on) don't apply to Looker API authentication.\n\nBecause of this, deleting a user's information from a user authentication protocol does not delete their API credentials. Using the procedures on the [Deleting Personal User Information](/looker/docs/deleting-personal-user-information) documentation page removes all of a user's personal data from Looker, preventing them from logging in at all, including through the API.\n\nManaging API credentials\n------------------------\n\n- Multiple sets of API credentials can be bound to a single Looker user account.\n- API credentials can be created and deleted without affecting the state of the user account.\n- Deleting a Looker user account invalidates all API credentials bound to the user account.\n- The API client secret must be kept private. Avoid storing API client secrets in source code or other places that can be seen by a lot of people.\n- In production, avoid using API credentials bound to Looker admin accounts. Create minimal privilege user accounts specifically for API activities (often called \"service accounts\") and create API credentials on those accounts. Grant only the permissions needed for the intended API activities.\n\nHTTPS authentication\n--------------------\n\nEven if you're using a client SDK to take care of the authentication details for you, you may still be curious about how Looker API authentication works. For low-level details about authentication, see [How to Authenticate to the Looker API](https://github.com/looker-open-source/looker-sdk-ruby/blob/master/authentication.md) on GitHub.\n\n\nAuthentication using OAuth\n--------------------------\n\nLooker can use the [Cross-Origin Resource Sharing (CORS)](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) protocol to let web applications make calls to the Looker API from outside a Looker instance's domain. See the [Looker API authentication using OAuth](/looker/docs/api-cors) documentation page for information about configuring CORS authentication."]]