Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
L'API Instance ID ti consente di integrare Instance ID con la tua app per Android
o iOS. Instance ID fornisce un identificatore univoco per ogni istanza della tua
app e un meccanismo per autenticare e autorizzare le azioni. Il InstanceID è di lunga
durata, ma potrebbe scadere per i seguenti motivi:
Ripristino dei dati di fabbrica del dispositivo.
L'utente disinstalla l'app.
L'utente esegue "Cancella dati" nell'app.
Dispositivo inutilizzato per un periodo prolungato (il periodo di tempo è determinato dal dispositivo e dalla regione).
Il servizio ID istanza rileva comportamenti illeciti o errori e reimposta
InstanceID.
Codice lato server se l'app client richiede questa funzionalità.
Il servizio Instance ID notifica alla tua app un ripristino di InstanceID tramite
callback a un InstanceIDListenerService. Se la tua app riceve questa
notifica, deve chiamare getToken() e recuperare il nuovo InstanceID,
e aggiornare i suoi server.
Utilizza il metodo getToken per dimostrare la proprietà di InstanceID e per consentire
ai server di accedere ai dati o ai servizi associati all'app. Il metodo segue
i pattern di OAuth2 e richiede un authorizedEntity e un scope. authorizedEntity può essere un ID progetto o un altro InstanceID e determina i servizi autorizzati a utilizzare il token generato. Il scope
determina il servizio o i dati specifici a cui il token consente l'accesso.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Mancano le informazioni di cui ho bisogno","missingTheInformationINeed","thumb-down"],["Troppo complicato/troppi passaggi","tooComplicatedTooManySteps","thumb-down"],["Obsoleti","outOfDate","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Problema relativo a esempi/codice","samplesCodeIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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)"]]