# firebase::installations::Installations


`#include <installations.h>`

[Installations](https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations) provides a unique identifier for each app instance and a mechanism to authenticate and authorize actions (for example, sending an FCM message).

## Summary

Provides a unique identifier for a Firebase installation. Provides an auth token for a Firebase installation. Provides a API to perform data deletion for a Firebase installation.

| ### Constructors and Destructors ||
|---|---|
| `https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations_1a79e9528d1af1901c19ac0fe90962fbad()` ||

| ### Public functions ||
|---|---|
| `https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations_1a6ff41720758cf84de9b5768918ecab56()` | `https://firebase.google.com/docs/reference/cpp/class/firebase/future#classfirebase_1_1_future< void >` Call to delete this Firebase app installation from the Firebase backend. |
| `https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations_1aacb699a57afd1d0e1402f14895e5b5f4()` | `https://firebase.google.com/docs/reference/cpp/class/firebase/future#classfirebase_1_1_future< void >` Get the results of the most recent call to [Delete](https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations_1a6ff41720758cf84de9b5768918ecab56). |
| `https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations_1a44470d6173aa186ebee21aa5fa2ca945()` | `https://firebase.google.com/docs/reference/cpp/class/firebase/future#classfirebase_1_1_future< std::string >` Returns a stable identifier that uniquely identifies the app installation. |
| `https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations_1a273a39376df26166a9ba432ed1c574a5()` | `https://firebase.google.com/docs/reference/cpp/class/firebase/future#classfirebase_1_1_future< std::string >` Get the results of the most recent call to [GetId](https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations_1a44470d6173aa186ebee21aa5fa2ca945). |
| `https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations_1aec064b547585cdd8aac69a3ed43321ae(bool forceRefresh)` | `https://firebase.google.com/docs/reference/cpp/class/firebase/future#classfirebase_1_1_future< std::string >` Returns a token that authorizes an Entity to perform an action on behalf of the application identified by installations. |
| `https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations_1a6490cc918c3629acdc501f62061a5337()` | `https://firebase.google.com/docs/reference/cpp/class/firebase/future#classfirebase_1_1_future< std::string >` Get the results of the most recent call to [GetToken](https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations_1aec064b547585cdd8aac69a3ed43321ae). |
| `https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations_1a046e144930c83fe9e1909add1f16bebe() const ` | `https://firebase.google.com/docs/reference/cpp/class/firebase/app#classfirebase_1_1_app *` Get the [App](https://firebase.google.com/docs/reference/cpp/class/firebase/app#classfirebase_1_1_app) this object is connected to. |

| ### Public static functions ||
|---|---|
| `https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations_1a9ce3d2a8a2116cb98153a5a25a3d951c(https://firebase.google.com/docs/reference/cpp/class/firebase/app#classfirebase_1_1_app *app)` | `https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations *` Returns the [Installations](https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations) object for an [App](https://firebase.google.com/docs/reference/cpp/class/firebase/app#classfirebase_1_1_app) creating the [Installations](https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations) if required. |

## Public functions

### Delete

```c++
Future< void > Delete()
```
Call to delete this Firebase app installation from the Firebase backend.

### DeleteLastResult

```c++
Future< void > DeleteLastResult()
```
Get the results of the most recent call to [Delete](https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations_1a6ff41720758cf84de9b5768918ecab56).

### GetId

```c++
Future< std::string > GetId()
```
Returns a stable identifier that uniquely identifies the app installation.

<br />

| Details ||
|---|---|
| **Returns** | Unique identifier for the app installation. |

### GetIdLastResult

```c++
Future< std::string > GetIdLastResult()
```
Get the results of the most recent call to [GetId](https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations_1a44470d6173aa186ebee21aa5fa2ca945).

### GetToken

```c++
Future< std::string > GetToken(
  bool forceRefresh
)
```
Returns a token that authorizes an Entity to perform an action on behalf of the application identified by installations.

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 Firebase Cloud Messaging, set entity to the sender ID, and set scope to "FCM".

<br />

Details Parameters `forceRefresh` If set true, will always return a new token. **Returns** Returns a valid authentication token for the Firebase installation.

### GetTokenLastResult

```c++
Future< std::string > GetTokenLastResult()
```
Get the results of the most recent call to [GetToken](https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations_1aec064b547585cdd8aac69a3ed43321ae).

### app

```c++
App * app() const 
```
Get the [App](https://firebase.google.com/docs/reference/cpp/class/firebase/app#classfirebase_1_1_app) this object is connected to.

<br />

| Details ||
|---|---|
| **Returns** | [App](https://firebase.google.com/docs/reference/cpp/class/firebase/app#classfirebase_1_1_app) this object is connected to. |

### \~Installations

```c++
 ~Installations()
```

## Public static functions

### GetInstance

```c++
Installations * GetInstance(
  App *app
)
```
Returns the [Installations](https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations) object for an [App](https://firebase.google.com/docs/reference/cpp/class/firebase/app#classfirebase_1_1_app) creating the [Installations](https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations) if required.

<br />

Details Parameters `app` The [App](https://firebase.google.com/docs/reference/cpp/class/firebase/app#classfirebase_1_1_app) to create an [Installations](https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations) object from. **Returns** [Installations](https://firebase.google.com/docs/reference/cpp/class/firebase/installations/installations#classfirebase_1_1installations_1_1_installations) object if successful, nullptr otherwise.