# Firebase Phone OTP - Android

Android has added **Play Integrity API** you can read more [here](https://developer.android.com/google/play/integrity). For OTP to work you need to do the following:

## Enable Play Integrity responses <a href="#enable-responses" id="enable-responses"></a>

To use the Play Integrity API, you must enable Play Integrity API responses by linking your app to a Google Cloud project. Then follow the instructions to integrate the API into your app.

### Apps on Google Play <a href="#apps-on-google-play" id="apps-on-google-play"></a>

In the Play Console, navigate to the **Release** section of the left menu. Go to **Setup > App integrity**. Select the **Integrity API** tab to get started.

### Apps exclusively distributed outside Google Play <a href="#apps-exclusively-distributed-outside-google-play" id="apps-exclusively-distributed-outside-google-play"></a>

You can enable Play Integrity API responses for your app without using the Google Play Console. To do so, complete these steps:

1. Choose an existing project or create a new project from the [Google Cloud Console](https://console.cloud.google.com).
2. Go to **APIs and services** and select **enable APIs and services**.
3. Search for **Play Integrity API**. Select it and then select **Enable**.

<figure><img src="/files/otMZQc9U4eERcO5ZCav2" alt=""><figcaption><p>Select Project &#x26; APIs</p></figcaption></figure>

<figure><img src="/files/sewTl38nEYNXpp5znfA7" alt=""><figcaption><p>Enable API keys</p></figcaption></figure>

<figure><img src="/files/cddsNo9kUaynntkw3WkD" alt=""><figcaption><p>Search api</p></figcaption></figure>

<figure><img src="/files/tY0Gt9fKeI6YnkYvbt0Y" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/xbu3EwVix3PcjxxSEnAj" alt=""><figcaption></figcaption></figure>

## SHA Keys

If you haven't yet specified your app's SHA-256 fingerprint, do so from the Settings Page of the Firebase console. For more info read [details here.](https://firebase.google.com/docs/auth/android/phone-auth)

![](/files/-MYGftnW3yJ62C-uxrw_)

## How to generate the app SHA1 and SHA256

You need to configure firebase phone auth for phone otp verification to work, without this you would running into errors building the app.

To solve this error, you need to add both your keystore SHA1 and SHA56 as well as debug SHA1 and SHA256 to fireabse console.

That means two **SHA1** and two **SHA256**

For debug keys use <https://developers.google.com/android/guides/client-auth?authuser=1> to get the key, Navigate to the **android folder** in the **project** in your **terminal/cmd,** Then type the following command below

```dart
//FOR WINDOWS
gradlew signingReport
//FOR MAC or Linux
.\gradlew signingReport
```

use `./gradlew signingReport` or `.\gradlew signingReport` if in windows to get debug keys.

### Release Keys

For release keys use [Keystore explorer](https://keystore-explorer.org/) to see the SHA1 and SHA256.

If the issue persists after changing your **SHA1** and **SHA256** make sure the following:

1. Change the google-services.json file again.
2. Delete the app in settings and add a new one with the right SHA1

### **SHA1 & SHA256 From google play console**

**NOTE:** If you are using issues with firebase OTP, you might have to also add the **SHA1** and **SHA256** from google Play app signing section.

![](/files/-McVgcXBjTjj6R0F8-K_)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://edentech.gitbook.io/glover/flutter-app/firebase-phone-otp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
