[Fixed] SMS verification code request failed: unknown status code: 17028 Invalid request fields in play_integrity_token – Flutter – Flutter

by
Ali Hasan
access-token firebase flutter sha1 sha256

Quick Fix: Phone authentication is not supported on emulators. Use test phone numbers or real devices for SMS verification.

The Problem:

Problem Statement:

Firebase phone number authentication requires a valid play_integrity_token, which ensures that the app is authorized to use the service and helps maintain security and prevent fraud.

However, in this case, the SMS verification code request is failing with an unknown status code 17028 and the error message ‘Invalid request fields in the play_integrity_token’. This indicates that the provided play_integrity_token is invalid or malformed.

The issue could be due to incorrect or invalid package name, SHA-1 fingerprint, or SHA-256 fingerprints configured in the Firebase Console. It’s crucial to verify that these details are correctly configured to ensure successful phone number authentication.

The Solutions:

Solution 1: Test with Real Device Instead of Emulator

This issue can occur when using an emulator to test phone number sign-in with a real phone number. To resolve this, use test phone numbers provided by Google Firebase instead of real numbers.

This restriction is due to Google’s policy, as phone number sign-in is only supported on real devices and the web. When using an emulator, Firebase Auth cannot verify the integrity of the device, so it returns an error indicating invalid request fields in the play_integrity_token.

Q&A

Can you use real phone number for sms verification in emulator?

No, real phone numbers can’t be used in emulator, use test numbers instead.

What to do if SMS verification always fails in emulator?

Wipe emulator data might help.

Video Explanation:

The following video, titled "Fix Firebase Error This App Is Not Authorized To Use Firebase ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

signInWithCredential:failure:com.google.firebase.auth.FirebaseAuthException: This app is not authorized to use Firebase Authentication.