인스턴스 ID API를 사용하면 인스턴스 ID를 Android 또는 iOS 앱과 통합할 수 있습니다. 인스턴스 ID는 앱의 각 인스턴스에 고유 식별자를 제공하고 작업을 인증하고 승인하는 메커니즘을 제공합니다. InstanceID는 수명이 길지만 다음과 같은 이유로 만료될 수 있습니다.
기기 초기화
사용자가 앱을 제거합니다.
사용자가 앱에서 '데이터 지우기'를 실행합니다.
장기간 사용되지 않은 기기 (기기 및 지역에 따라 기간이 결정됨)
인스턴스 ID 서비스가 악용 또는 오류를 감지하고 InstanceID를 재설정합니다.
클라이언트 앱에 해당 기능이 필요한 경우 서버 측 코드
인스턴스 ID 서비스는 InstanceIDListenerService에 대한 콜백을 통해 InstanceID 재설정을 앱에 알립니다. 앱이 이 알림을 수신하면 getToken()를 호출하여 새 InstanceID를 가져오고 서버를 업데이트해야 합니다.
getToken 메서드를 사용하여 InstanceID의 소유권을 증명하고 서버가 앱과 연결된 데이터 또는 서비스에 액세스하도록 허용합니다. 이 메서드는 OAuth2 패턴을 따르며 authorizedEntity 및 scope가 필요합니다. authorizedEntity는 프로젝트 ID 또는 다른 InstanceID일 수 있으며, 생성된 토큰을 사용할 수 있는 서비스를 결정합니다. scope은 토큰이 액세스를 허용하는 특정 서비스 또는 데이터를 결정합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-05(UTC)"],[[["\u003cp\u003eThe Instance ID API provides a unique identifier for each app instance and enables authentication and authorization.\u003c/p\u003e\n"],["\u003cp\u003eInstance IDs are long-lived but can expire due to various factors like device reset, uninstallation, data clearing, extended inactivity, or service-detected issues.\u003c/p\u003e\n"],["\u003cp\u003eUpon Instance ID reset, apps are notified and must retrieve a new ID using \u003ccode\u003egetToken()\u003c/code\u003e and update their servers.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetToken()\u003c/code\u003e method, using OAuth2 patterns, verifies Instance ID ownership and grants server access to associated data or services based on authorized entity and scope.\u003c/p\u003e\n"]]],[],null,["# Instance ID API\n\nThe Instance ID API lets you integrate Instance ID with your Android\nor iOS app. Instance ID provides a unique identifier for each instance of\nyour app and a mechanism to authenticate and authorize actions. The `InstanceID` is long\nlived, but may expire for the following reasons:\n\n- Device factory reset.\n- User uninstalls the app.\n- User performs \"Clear Data\" in the app.\n- Device unused for an extended period (device and region determines the timespan).\n- Instance ID service detects abuse or errors and resets the `InstanceID`.\n- Server-side code if your client app requires that functionality.\n\nThe Instance ID service notifies your app of an `InstanceID` reset via\ncallback to a `InstanceIDListenerService`. If your app receives this\nnotification, it must call `getToken()` and retrieve the new `InstanceID`,\nand update its servers.\n\nUse the `getToken` method to prove the ownership of the `InstanceID` and to allow\nservers to access data or services associated with the app. The method follows\nthe patterns of OAuth2, and requires an `authorizedEntity` and `scope`. The\n`authorizedEntity` can be a project ID or another `InstanceID`, and it determines\nthe services that are authorized to use the generated token. The `scope`\ndetermines the specific service or data to which the token allows access.\n\nLearn more about the Instance ID API for:\n\n[Android](/instance-id/reference/android/api)\n[iOS](/instance-id/reference/ios/api)\n[Server](/instance-id/reference/server)"]]