React-native-firebase: firebase phone auth not works after generating signed APK

Created on 14 May 2018  ·  13Comments  ·  Source: invertase/react-native-firebase

Hello,
after I generated signed apk in android by
cd android && ./gradlew assembleRelease
I tested on my phone with the apk I generated and when I enter my phone nothing happened return error

Error: this app is not authorized to use firebase authentication. please verifythat the correct package name and sha-1 are configured in the firebase console.

BUT when I run the app without the apk, with
react-native run-android
everything works good.

` confirmPhone = async (phoneNumber) => {
        const phoneWithAreaCode = phoneNumber.replace(/^0+/,'+972');
        return new Promise((res, rej) => {
            firebase.auth().verifyPhoneNumber(phoneWithAreaCode)
                .on('state_changed', async (phoneAuthSnapshot) => {
                    console.log('phone-->',phoneAuthSnapshot)
                    switch (phoneAuthSnapshot.state) {
                    case firebase.auth.PhoneAuthState.AUTO_VERIFIED:
                        await this.confirmCode(phoneAuthSnapshot.verificationId, phoneAuthSnapshot.code, phoneAuthSnapshot)
                        res(phoneAuthSnapshot)

                        break

                    case firebase.auth.PhoneAuthState.CODE_SENT:
                        UserStore.setVerificationId(phoneAuthSnapshot.verificationId)
                        res(phoneAuthSnapshot)
                        break

                    case firebase.auth.PhoneAuthState.AUTO_VERIFY_TIMEOUT: 
                        UserStore.setVerificationId(phoneAuthSnapshot.verificationId)
                        UserStore.setErrorCodeAuthentication('SMS code has expired')
                        res(phoneAuthSnapshot)


                    case firebase.auth.PhoneAuthState.ERROR:
                        // console.log(phoneAuthSnapshot)
                        // if(NavigationStore.CurrentRoute == 'Login'){
                        //     UserStore.setErrorCodeAuthentication('Please enter valid phone number')
                        // }else
                        //     UserStore.setErrorCodeAuthentication('Pin code invalid')
                        rej(phoneAuthSnapshot)
                        break

                    }
                })
        })
    }

    confirmCode = async (verificationId, code, phoneAuthSnapshot) => {
           try{
            const credential = await firebase.auth.PhoneAuthProvider.credential(UserStore.verificationId, code)
            UserStore.setCodeInput(code)
            UserStore.setUserCredentials(credential)
            AppStore.setAlreadyRegister(true)
            await this.authenticate(credential)
            return credential
           } catch(e){
               throw new Error(e)
           }


    }

    authenticate = async (credential) => {
         await firebase.auth().signInAndRetrieveDataWithCredential(credential)

    }`

Most helpful comment

It's simple, download (KeyStore Explorer 5.3.2) and open your .jks file using KeyStore Explorer it will ask for a password, enter your password that you entered at the time of generating signed apk. Then once it gets opened click on entry name there you will see Fingerprint SHA-1 key like (10:02:A6:3E:A9:68:83:FE:F2:66:6F:F8:C4:9D:FF:3C:C2:EA:76:96) this is fake SHA-1 ok, Enjoy[enter image description here][1]

link : https://www.mediafire.com/file/ysm9ajb72u7u9h9/kse-540-setup.exe/file

All 13 comments

@adirzoari you will need to generate the SHA-1 for your release keystore and add this to your Firebase project.

Once you sent all the KeyStore settings as mentioned in the Facebook Document. In Android Studio, click on the gradle on the right side. Then app -> Tasks -> android -> signingReport . This will log SHA-1 , SHA-256 , MD5 etc.

i have same issue
Error: this app is not authorized to use firebase authentication. please verifythat the correct package name and sha-1 are configured in the firebase console.

i have already added SHA-1 package name to firebase but could not resolve this error

someone could solve it I have exactly the same problem when signing the apk I do not work the authentication by phone

@nomi9995 please check my answer there
https://stackoverflow.com/questions/50085575/react-native-with-firebase-phone-auth-validation-failed

if it still not works to you, let me know.

It's simple, download (KeyStore Explorer 5.3.2) and open your .jks file using KeyStore Explorer it will ask for a password, enter your password that you entered at the time of generating signed apk. Then once it gets opened click on entry name there you will see Fingerprint SHA-1 key like (10:02:A6:3E:A9:68:83:FE:F2:66:6F:F8:C4:9D:FF:3C:C2:EA:76:96) this is fake SHA-1 ok, Enjoy[enter image description here][1]

link : https://www.mediafire.com/file/ysm9ajb72u7u9h9/kse-540-setup.exe/file

@adirzoari, hello mate,
i tried your solution i got the new google-services.json and replaced it but i cant generate the signingReport since i cant see the gradle menu anywhere in android studio, i successfully ran the gradle console with help of search icon...

It's simple, download (KeyStore Explorer 5.3.2) and open your .jks file using KeyStore Explorer it will ask for a password, enter your password that you entered at the time of generating signed apk. Then once it gets opened click on entry name there you will see Fingerprint SHA-1 key like (10:02:A6:3E:A9:68:83:FE:F2:66:6F:F8:C4:9D:FF:3C:C2:EA:76:96) this is fake SHA-1 ok, Enjoy[enter image description here][1]

link : https://www.mediafire.com/file/ysm9ajb72u7u9h9/kse-540-setup.exe/file

work fine, thanks you

You welcome

On Thu, Feb 14, 2019, 6:58 AM yoko <[email protected] wrote:

It's simple, download (KeyStore Explorer 5.3.2) and open your .jks file
using KeyStore Explorer it will ask for a password, enter your password
that you entered at the time of generating signed apk. Then once it gets
opened click on entry name there you will see Fingerprint SHA-1 key like
(10:02:A6:3E:A9:68:83:FE:F2:66:6F:F8:C4:9D:FF:3C:C2:EA:76:96) this is fake
SHA-1 ok, Enjoy[enter image description here][1]

link :
https://www.mediafire.com/file/ysm9ajb72u7u9h9/kse-540-setup.exe/file

work fine, thanks you


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/invertase/react-native-firebase/issues/1086#issuecomment-463440150,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AetU0GsVqNRvozznLDNlMCJoO4dnMxt6ks5vNLShgaJpZM4T-Nyp
.

Firebase actually uses the public SHA1 generated by Google, not the SHA1 you created in the release. You can download this certificate or copy paste the SHA1 from your Play Store Console > App Signing page

Firebase actually uses the public SHA1 generated by Google, not the SHA1 you created in the release. You can download this certificate or copy paste the SHA1 from your Play Store Console > App Signing page

Out of curiosity, is that always true, or only true when you do App Bundles or let Google manage the signing? If I understood correctly it was still possible (if you wanted to manage your own key, and wanted to deliver exactly the APKs you uploaded) to do a Play Store release where the signing key was local and Google just distributed the APK as is.

It's simple, download (KeyStore Explorer 5.3.2) and open your .jks file using KeyStore Explorer it will ask for a password, enter your password that you entered at the time of generating signed apk. Then once it gets opened click on entry name there you will see Fingerprint SHA-1 key like (10:02:A6:3E:A9:68:83:FE:F2:66:6F:F8:C4:9D:FF:3C:C2:EA:76:96) this is fake SHA-1 ok, Enjoy[enter image description here][1]

link : https://www.mediafire.com/file/ysm9ajb72u7u9h9/kse-540-setup.exe/file

THANKS A LOT IT WORKS

Это просто, загрузите (KeyStore Explorer 5.3.2) и откройте свой файл .jks с помощью KeyStore Explorer, он запросит пароль, введите пароль, который вы ввели во время создания подписанного apk. Затем, когда он откроется, щелкните имя записи, там вы увидите ключ SHA-1 отпечатка пальца, например (10: 02: A6: 3E: A9: 68: 83: FE: F2: 66: 6F: F8: C4: 9D: FF: 3C: C2: EA: 76: 96) это поддельный SHA-1, хорошо, наслаждайтесь [введите описание изображения здесь] [1]

ссылка: https://www.mediafire.com/file/ysm9ajb72u7u9h9/kse-540-setup.exe/file

Thank you very much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Damnum picture Damnum  ·  3Comments

dgruseck picture dgruseck  ·  3Comments

romreed picture romreed  ·  3Comments

n-scope picture n-scope  ·  3Comments

escobar5 picture escobar5  ·  3Comments