

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 요청 인증
<a name="tracking-identity-pool"></a>

트래커 리소스를 생성하고 지오펜스를 기준으로 디바이스 위치를 평가할 준비가 되었으면 요청을 인증할 방법을 선택합니다.
+ 서비스에 액세스할 수 있는 방법을 알아보려면 [Amazon Location Service로 인증](access.md) 섹션을 참조하세요.
+ 인증되지 않은 요청이 있는 디바이스 위치를 게시하려면 Amazon Cognito를 사용하는 것이 좋습니다.

  **예제**

  다음 예시는 권한 부여를 위한 Amazon Cognito ID 풀 사용, [AWS JavaScript SDK v3](https://aws.amazon.com/sdk-for-javascript/) 및 Amazon Location [웹](how-to-auth-helper.md#loc-sdk-auth-web) 사용을 보여줍니다.

  ```
  import { LocationClient, BatchUpdateDevicePositionCommand } from "@aws-sdk/client-location";
  import { withIdentityPoolId } from "@aws/amazon-location-utilities-auth-helper";
  
  // Unauthenticated identity pool you created
  const identityPoolId = "us-east-1:1234abcd-5678-9012-abcd-sample-id";
  
  // Create an authentication helper instance using credentials from Cognito
  const authHelper = await withIdentityPoolId(identityPoolId);
  
  const client = new LocationClient({
    region: "us-east-1", // The region containing both the identity pool and tracker resource
    ...authHelper.getLocationClientConfig(), // Provides configuration required to make requests to Amazon Location
  });
  
  const input = {
    TrackerName: "ExampleTracker",
    Updates: [
      {
        DeviceId: "ExampleDevice-1",
        Position: [-123.4567, 45.6789],
        SampleTime: new Date("2020-10-02T19:09:07.327Z"),
      },
      {
        DeviceId: "ExampleDevice-2",
        Position: [-123.123, 45.123],
        SampleTime: new Date("2020-10-02T19:10:32Z"),
      },
    ],
  };
  
  const command = new BatchUpdateDevicePositionCommand(input);
  
  // Send device position updates
  const response = await client.send(command);
  ```