firebasereact-native

SSO configured using firebase for react native app works on emulator but not on real android device


I have configured SSO for my react native app using firebase and it's working perfectly on emulator but when I try the it from a real device it does not work as expected . Can anyone please tell me What is the reason behind this ?

I have tried adding the SHA-1 and SHA-256 keys to the firebase console and generated the new google.services.json and build the project once more but that didn't work as well . When I generate the keys using ./gradlew signingReport I can see the two keys which are

Variant: debug Config: debug

and ,

Variant: release Config: debug

keys are the same . When I go through the solutions that I've found on internet they are suggesting that these keys should be added to the firebase console . I can add only one SHA-1 key and only one SHA-256 key because my keys are the same . Need help on this matter .


Solution

  • I have been able to fix this by adding

    <application
        android:usesCleartextTraffic="true"
        android:name=".MainApplication">
    

    to the androidManifest.xml . Android (starting from version 9) blocks cleartext traffic (unencrypted HTTP communication) by default . My server runs on http and what I have learned is by adding this I'm allowing the app to bypass android's default restriction [ by allowing cleartext traffic which is unencrypted http communication ] and continue to communicate with the server .