Issue
I follow the docs download google-service.json and also add SH1 key in firebase console and then copy the example code and try to run it but i saw the below issue.Help Needed. Thanks.
This request is missing a valid app identifier, meaning that neither SafetyNet checks nor reCAPTCHA checks succeeded. Please try again, or check the logcat for more details.
Javascript
import React, { useState } from 'react';
import { Button, TextInput, View } from 'react-native';
import auth from '@react-native-firebase/auth';
const PhoneSignIn = ()=>{
// If null, no SMS has been sent
const [confirm, setConfirm] = useState(null);
const [number, setNumber] = useState(false)
const [code, setCode] = useState('');
// Handle the button press
const _signInWithPhoneNumber = async()=>{
if(!number) return
alert(number)
const confirmation = await auth().signInWithPhoneNumber(number)
console.log(confirmation)
setConfirm(confirmation);
}
const confirmCode= async()=>{
try {
await confirm.confirm(code).then(res => {
alert(`Verified! ${res.user.uid}`)
})
} catch (error) {
console.log('Invalid code.');
}
}
if (!confirm) {
return (
<View style= {{flex: 1}}>
<TextInput style={{ width: '100%%'}} placeholder= "enter number +923075018584" onChangeText={text => setNumber(text)}/>
<Button
title="Phone Number Sign In"
onPress={() => _signInWithPhoneNumber()}
/>
</View>
);
}
return (
<>
<TextInput value={code} placeholder="Code" onChangeText={text => setCode(text)} />
<Button title="Confirm Code" onPress={() => confirmCode()} />
</>
);
}
export default PhoneSignIn
package.json
:
"@react-native-firebase/app": "^8.4.7",
"@react-native-firebase/auth": "^9.3.2",
"react-native": "^0.63.2",
Have you converted to AndroidX?
- my application is an AndroidX application?
- I am using
android/gradle.settings
jetifier=true
for Android compatibility? - I am using the NPM package
jetifier
for react-native compatibility?
I had the same issue; The SHA-1 and SHA-256 fingerprints I provided at Firebase Console were not correct somehow.
Executed this command in Project’s root directory
keytool -list -v -keystore ./android/app/debug.keystore -alias androiddebugkey -storepass android -keypass android
to get SHA-1 and SHA-256 fingerprints.Updating Firebase console with newly acquired values resolved the issue for me.