با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
ویژگی های کلیدی
Instance ID علاوه بر ارائه شناسه های منحصر به فرد برای احراز هویت، می تواند توکن های امنیتی را برای استفاده با سایر سرویس ها ایجاد کند. ویژگی های دیگر عبارتند از:
توکن های امنیتی تولید کنید
Instance ID یک API ساده برای تولید نشانههای امنیتی ارائه میکند که به اشخاص ثالث اجازه دسترسی به منابع مدیریت شده سمت سرور برنامه شما را میدهد.
تأیید صحت برنامه
کدهای Instance ID را به سرور خود منتقل کنید و از سرویس Instance ID استفاده کنید تا نام بسته برنامه را تأیید کنید و بررسی کنید که آیا امضای معتبری دارد یا خیر. تأیید توکن ها با Instance ID Cloud Service به شناسایی برنامه های شناخته شده کمک می کند. برای کاهش هزینه و ارتباطات اضافی رفت و برگشت، سرور خود را طوری پیکربندی کنید که این نشانه ها را ذخیره کند تا بررسی فقط یک بار مورد نیاز باشد. در صورت بروز نگرانی امنیتی، برنامه شما میتواند توکنها یا خود Instance ID را حذف کرده و موارد جدیدی ایجاد کند. علاوه بر این، سرور Instance ID در صورت شناسایی اشکالات یا مسائل امنیتی، کد یا Instance ID را بهروزرسانی میکند.
فعال بودن دستگاه برنامه را تأیید کنید
سرور Instance ID می تواند به شما بگوید آخرین بار چه زمانی دستگاهی که برنامه شما روی آن نصب شده است استفاده شده است. از این برای تصمیم گیری در مورد حفظ داده ها از برنامه خود یا ارسال پیام فشار برای تعامل مجدد با کاربران خود استفاده کنید.
برنامه ها را شناسایی و ردیابی کنید
شناسه نمونه در تمام نمونههای برنامه در سراسر جهان منحصربهفرد است، بنابراین پایگاه داده شما میتواند از آن برای شناسایی و ردیابی منحصربهفرد نمونههای برنامه استفاده کند. کد سمت سرور شما میتواند از طریق سرویس ابری Instance ID تأیید کند که شناسه نمونه واقعی است و همان شناسه برنامه اصلی است که در سرور شما ثبت شده است. برای حفظ حریم خصوصی، برنامه شما میتواند شناسه نمونه را حذف کند تا دیگر با هیچ سابقهای در پایگاه داده مرتبط نباشد. دفعه بعد که برنامه شما با Instance ID تماس می گیرد، یک Instance ID کاملاً جدید دریافت می کند که هیچ ارتباطی با شناسه قبلی خود ندارد.
چرخه عمر ID نمونه
هنگامی که برنامه شما آنلاین می شود، سرویس Instance ID یک InstanceID صادر می کند. InstanceID توسط یک جفت کلید عمومی/خصوصی با کلید خصوصی ذخیره شده در دستگاه محلی و کلید عمومی ثبت شده در سرویس Instance ID پشتیبانی می شود.
برنامه شما می تواند هر زمان که نیاز باشد با استفاده از روش getID() یک InstanceID جدید درخواست کند. اگر برنامهای دارید که از برنامه شما پشتیبانی میکند، میتواند آن را روی سرورتان ذخیره کند.
برنامه شما میتواند با استفاده از روش getToken() از سرویس Instance ID توکنها را درخواست کند و مانند InstanceID ، برنامه شما همچنین میتواند توکنها را در سرور خود ذخیره کند. همه نشانههای صادر شده برای برنامه شما متعلق به InstanceID برنامه هستند.
توکنها منحصربهفرد و امن هستند، اما برنامه شما یا سرویس Instance ID ممکن است در صورت بروز مشکل امنیتی یا زمانی که کاربر برنامه شما را در حین بازیابی دستگاه حذف نصب و مجدداً نصب میکند، نیاز به بازخوانی نشانهها داشته باشد. برنامه شما باید یک شنونده برای پاسخ به درخواستهای تازهسازی رمز از سرویس Instance ID اجرا کند.
پیاده سازی مشتری
Instance ID هم در اندروید و هم در iOS اجرا می شود. هر کدام از شما نیاز دارند که کتابخانه مناسب را در برنامه مشتری خود قرار دهید. Android به خدمات Google Play نیاز دارد. اگر قصد تولید توکن دارید، به شناسه پروژه تولید شده توسط کنسول توسعه دهندگان Google نیاز دارید.
برای دستورالعمل های دقیق، راهنمای پیاده سازی Android و iOS را ببینید.
تاریخ آخرین بهروزرسانی 2025-09-03 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-09-03 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003e\u003cstrong\u003eWarning:\u003c/strong\u003e The Instance ID API is deprecated; for unique app installation identifiers, use the Firebase installations API instead.\u003c/p\u003e\n"],["\u003cp\u003eInstance ID offers key features like generating security tokens, verifying app authenticity, confirming app device activity, and identifying/tracking apps.\u003c/p\u003e\n"],["\u003cp\u003eInstance ID has a lifecycle involving issuing an ID, requesting fresh IDs and tokens, storing them on the server (optional), and handling token refreshes.\u003c/p\u003e\n"],["\u003cp\u003eClient implementation requires including the appropriate library and potentially a Project ID for token generation.\u003c/p\u003e\n"],["\u003cp\u003eFor detailed instructions, refer to the Android and iOS implementation guides.\u003c/p\u003e\n"]]],[],null,["# What is Instance ID?\n\n| **Warning:** The Instance ID API is deprecated. If you need to access unique app installation identifiers, use the [Firebase installations](//firebase.google.com/docs/projects/manage-installations) API. See also [Firebase installations and Instance ID](//firebase.google.com/docs/projects/manage-installations#fid-iid). The [server-side topic management API](https://developers.google.com/instance-id/reference/server#create_relationship_maps_for_app_instances) is still available.\n\nKey features\n------------\n\nIn addition to providing unique IDs for authentication, Instance ID\ncan generate security tokens for use with other services. Other features\ninclude:\n\n### Generate Security Tokens\n\n: Instance ID provides a simple API to generate security tokens that\n authorize third parties to access your app's server side managed resources.\n\n### Verify app authenticity\n\n: Pass Instance ID tokens to your server and use the Instance ID\n service to verify the app package name and check if it has a valid signature.\n Verifying tokens with the Instance ID Cloud Service helps identify known\n apps. To reduce cost and redundant round trip communications, configure your\n server to store these tokens so the check is needed only once.\n In the event of a security concern, your app can delete tokens, or\n Instance ID itself, and generate new ones. In addition, the\n Instance ID server initiates token or Instance ID refresh if it\n detects bugs or security issues.\n\n### Confirm app device is active\n\n: The Instance ID server can tell you when the device on which your app\n is installed was last used. Use this to decide whether to keep data from your\n app or send a push message to reengage with your users.\n\n### Identify and track apps\n\n: Instance ID is unique across all app instances across the world, so\n your database can use it to uniquely identify and track app instances. Your\n server-side code can verify, via the Instance ID cloud service, that an\n Instance ID is genuine and is the same ID as the original app that\n registered with your server. For privacy, your app can delete an Instance ID so\n it is no longer associated with any history in the database. The next time your\n app calls Instance ID it will get an entirely new Instance ID with no\n relationship to its previous one.\n\nInstance ID lifecycle\n---------------------\n\n1. The Instance ID service issues an `InstanceID` when your app comes online. The `InstanceID` is backed by a public/private key pair with the private key stored on the local device and the public key registered with the Instance ID service.\n2. Your app can request a fresh `InstanceID` whenever needed using the `getID()` method. Your app can store it on your server if you have one that supports your app.\n3. Your app can request tokens from the Instance ID service as needed using the `getToken()` method, and like `InstanceID`, your app can also store tokens on your own server. All tokens issued to your app belong to the app's `InstanceID`.\n4. Tokens are unique and secure, but your app or the Instance ID service may need to refresh tokens in the event of a security issue or when a user uninstalls and reinstalls your app during device restoration. Your app must implement a listener to respond to token refresh requests from the Instance ID service.\n\nClient implementation\n---------------------\n\nInstance ID runs on both Android and iOS. Each requires you to include\nthe appropriate library in your client app. Android requires\n[Google Play Services](https://developer.android.com/google/play-services/index.html). You will need a Project ID generated\nby the [](/console/help/new)[Google Developers Console](https://console.developers.google.com/project) if you intend\nto generate tokens.\n\nFor detailed instructions, see the [Android](/instance-id/guides/android-implementation)\nand [iOS](/instance-id/guides/ios-implementation) implementation guides."]]