Firebase.InstanceId.FirebaseInstanceId

Instance ID provides a unique identifier for each app instance and a mechanism to authenticate and authorize actions (for example, sending a FCM message).

Summary

An Instance ID is long lived, but might be reset if the device is not used for a long time or the Instance ID service detects a problem. If the Instance ID has become invalid, the app can request a new one and send it to the app server. To prove ownership of Instance ID and to allow servers to access data or services associated with the app, call GetToken.

Inheritance

Inherits from: SystemIDisposable

Properties

App
App object associated with this instance ID.
DefaultInstance
InstanceId associated with the default Firebase App.

Public functions

DeleteIdAsync()
Delete the ID associated with the app, revoke all tokens and allocate a new ID.
DeleteTokenAsync()
Revokes access to a scope (action)
Dispose()
virtual void
GetIdAsync()
Returns a stable identifier that uniquely identifies the app instance.
GetTokenAsync()
Returns a token that authorizes an Entity to perform an action on behalf of the application identified by Instance ID.

Public static functions

GetInstanceId(FirebaseApp app)
Returns the InstanceId object for an App creating the InstanceId if required.

Properties

App

FirebaseApp App

App object associated with this instance ID.

DefaultInstance

static FirebaseInstanceId DefaultInstance

InstanceId associated with the default Firebase App.

Details
Returns
An InstanceId object associated with the default Firebase App.

Public functions

DeleteIdAsync

System.Threading.Tasks.Task DeleteIdAsync()

Delete the ID associated with the app, revoke all tokens and allocate a new ID.

DeleteTokenAsync

System.Threading.Tasks.Task DeleteTokenAsync()

Revokes access to a scope (action)

Dispose

virtual void Dispose()

GetIdAsync

System.Threading.Tasks.Task< string > GetIdAsync()

Returns a stable identifier that uniquely identifies the app instance.

Details
Returns
Unique identifier for the app instance.

GetTokenAsync

System.Threading.Tasks.Task< string > GetTokenAsync()

Returns a token that authorizes an Entity to perform an action on behalf of the application identified by Instance ID.

This is similar to an OAuth2 token except, it applies to the application instance instead of a user.

For example, to get a token that can be used to send messages to an application via FirebaseMessaging, set entity to the sender ID, and set scope to "FCM".

Details
Returns
A token that can identify and authorize the instance of the application on the device.

Public static functions

GetInstanceId

FirebaseInstanceId GetInstanceId(
  FirebaseApp app
)

Returns the InstanceId object for an App creating the InstanceId if required.

Details
Parameters
app
The App to create an InstanceId object from. On iOS this must be the default FirebaseApp.
Returns
InstanceId object if successful, null otherwise.

Send feedback about...

Need help? Visit our support page.