For the complete documentation index, see llms.txt. This page is also available as Markdown.

User.getAnonymousKey

함수형 API getAnonymousKey으로도 같은 기능을 쓸 수 있어요.

기능 설명

미니앱에서 사용자의 고유 키를 가져와요. 이 키로 사용자를 식별하고 데이터를 관리할 수 있어요. 성공하면 { type: 'HASH', hash } 형태의 값을 반환해요.

토스앱 5.232.0 이상에서 사용할 수 있어요.

타입

User.getAnonymousKey(): Promise<GetAnonymousKeyResponse>;

Params

없음

Response

type GetAnonymousKeyResponse = {
  hash: string;
  type: "HASH";
};

예시 코드

import { User } from "@apps-in-toss/web-framework";

async function handleGetAnonymousKey() {
  try {
    const result = await User.getAnonymousKey();
    console.log("사용자 키:", result.hash);
  } catch (error) {
    console.error(error);
  }
}

도움이 되었나요?