Manufacturer Center API로 OAuth 2.0 서비스 계정 사용

서비스 계정은 애플리케이션에서 OAuth 2.0을 통해 프로그래매틱 방식으로 Google API에 액세스하는 데 사용할 수 있는 특별한 Google 계정입니다. 서비스 계정은 추가 승인이 필요하지 않은 OAuth 2.0 흐름을 사용합니다. 대신 애플리케이션만 액세스할 수 있는 키 파일을 사용합니다. 이 가이드에서는 서비스 계정으로 Manufacturer Center API에 액세스하는 방법을 설명합니다.

기본 요건

서비스 계정을 사용하여 Manufacturer Center API에 액세스하는 단계

  1. 서비스 계정 사용자 인증 정보를 생성하거나 이미 생성한 공개 사용자 인증 정보에 액세스합니다. OAuth 2.0 클라이언트 ID를 만들고 *.json 비공개 키 파일을 가져와야 합니다.

    1. Google API 콘솔로 이동합니다.

    2. 페이지 상단의 드롭다운 메뉴에서 프로젝트를 선택합니다. 아직 프로젝트가 없으면 프로젝트 만들기를 클릭하여 프로젝트를 만듭니다.

    3. 이 프로젝트에 아직 Manufacturer Center API를 사용 설정하지 않았다면 Google API 목록에서 검색하여 사용 설정합니다.

    4. 왼쪽 사이드바에서 사용자 인증 정보를 선택합니다.

    5. 서비스 계정을 설정하려면 사용자 인증 정보 만들기를 선택한 다음 서비스 계정 키를 선택합니다. ]]>서비스 계정 사용자 인증 정보 만들기

스크린샷.](../images/create_service_account_credentials.png)

6.  On the next page, select **New service account** from the drop-down
    list.

7.  <a name="service-account-name"></a> Name the new service account. This
    also serves as the default username for the service account ID. Remember
the service account ID for use later.

Note: The choice of role for the service account will not have any effect on
what calls can be made to the Manufacturer Center API, as access to
    Manufacturer Center API methods is determined instead by the role
    associated with the service account ID in Manufacturer Center. If you
    are unsure what to pick, just pick Project►Viewer.

![New service account name

스크린샷](../images/new_service_account_name.png)

8.  Select **JSON** for the key type, then click **Create**.

9.  The **Create** button will change to **Creating...**, and once the key
    generation finishes, it will automatically download the private key as a
*.json file.

Important: Protect the *.json key file that allows a service account to
    access the Google services for which it has been authorized. It is good
practice to allow service accounts to only access one Google API each. This
is a preventative measure to mitigate the amount of data an attacker can
    access in the situation that the service account's *.json key file is
    compromised.

10.  You will be returned to the Credentials page, and you should see the
    new service account in the list of service account keys for your
    account.
  1. 새 서비스 계정을 Manufacturer Center 계정에 사용자로 추가합니다. 서드 파티 개발자는 이 단계를 대신 진행하도록 클라이언트에 요청해야 합니다.

    1. Manufacturer Center 계정으로 이동합니다.

    2. Manufacturer Center 계정 설정의 '사용자' 목록으로 이동합니다.

    3. +사용자 버튼을 클릭하고 서비스 계정 ID를 새 사용자의 이메일 주소로 사용합니다. \n서비스 계정 사용자 추가 버튼

스크린샷](../images/add_service_account_network_settings.png)

4.  Fill in the form with the [service account ID](#service-account-name),
    and select the desired user role(s). At least one must be chosen, and
    use of the `Accounts` service requires the Admin role.

If you did not take note of the service account ID earlier, go to the
    [Service
    Accounts](https://console.developers.google.com/iam-admin/serviceaccounts/)
administration page and select the project you created.

![Add service account user page

스크린샷](../images/add_service_account_page.png)

5.  Click on the **Save** button. You will be returned to the list of users,
and the service account ID should be listed with the chosen user role(s).

6.  Repeat the process for all other service accounts you want to add.

7.  View existing service account users by going to the Users tab. These
    will be users with an email address ending in 'gserviceaccount.com'.
  1. 이제 Google 애플리케이션 기본 사용자 인증 정보 흐름을 사용하거나 직접 서비스 계정 흐름을 사용하여 서비스 계정을 사용하여 Manufacturer Center 계정에 액세스할 수 있습니다. Manufacturer Center API 샘플에서는 지원되는 각 프로그래밍 언어로 서비스 계정 사용자 인증 정보에 두 흐름을 모두 사용하는 방법을 보여줍니다. 코드 샘플을 참고하여 새 서비스 계정을 사용해보고 자체 코드로 서비스 계정을 사용하는 데 필요한 변경사항을 알아보세요.

자주 묻는 질문(FAQ)

서비스 계정을 사용해 Manufacturer Center 웹 사용자 인터페이스에 로그인할 수 있나요?

아니요. 서비스 계정은 일반 Google 계정이 아니며 Manufacturer Center 웹 사용자 인터페이스에 액세스할 수 없습니다.

서비스 계정 액세스 토큰을 얼마나 자주 새로고침해야 하나요?

액세스 토큰은 Google OAuth 2.0 승인 서버에서 발급되고 1시간이 지나면 만료됩니다. 액세스 토큰이 만료되면 애플리케이션은 클라이언트 라이브러리를 사용하여 다른 액세스 토큰을 가져와야 합니다.