-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crashing on signInAndRetrieveDataWithCredential() #1249
Comments
@0paIescent could you check the android adb logs output to retrieve the native error and let us know what it says? Thanks |
@Salakar I'm actually looking into it right now coincidentally, it's throwing an IllegalArgumentException in promiseWithAuthResult() in RNFirebaseAuth.java. It can't convert react-native-firebase/androidsrc/main/java/io/invertase/firebase/auth/RNFirebaseAuth.java:
The getProfile() calls properly as I can log the data from it, so everything gets passed in properly. react-native-firebase/androidsrc/main/java/io/invertase/firebase/Utils.java:
react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/Arguments.java:
Hopefully that was everything you needed, let me know if you want anything else. Thanks for responding so promptly too by the way! |
@0paIescent thanks for the extra information, helpful! Are you able to log out / inspect |
I believe the issue is just that addEntry() doesn't support JSONObjects, but JSON packages don't seem to be available in React Native's code |
@0paIescent thought it might be random data types causing it to crash, you're right it is the JSONObjects, RN's Arguments class doesn't handle these 🙈 Not sure the best way to approach a fix for this, might be worth adding in a custom util to handle profile conversion to a Thanks for helping debug |
@Salakar Yeah, as anti-pattern as it is, I think I'll just end up using toString() and dealing with it in js, the silly part is, I don't really even need any of the additionalUserInfo. I was thinking of going in and import JSONObject to check for |
Sadly, I think the only way to modify the source files for React Native would be to build it from source. I'll test that out later and let you know what I find out. |
@0paIescent your best bet would be to make a local change to support it in your node_modules for this library and rebuild your android app to test |
I had exactly same issue and forked this repository to make workaround in native code, But I hope I can fix it with only javascript code. Any ideas can be helpfull. |
The way I fixed it was by adding an else if to the addEntry function in
com.facebook.react.bridge.Arguments.java like this:
else if (value.getClass().getName() == "org.json.JSONObject$1") {
nativeMap.putString(key, (String) value.toString());
}
This resolves the issue entirely since JS automatically converts
stringified JSON into a JS Object.
You will need to build React Native from source, but it's a lot easier than the docs make it out to be. I can explain it to you more in depth tomorrow, it's getting late here.
|
@0paIescent Thank you for your answer!! It is better way to fix this issue. |
l just used the source code from node_modules and built the archives from that. |
@0paIescent Thanks. |
@0paIescent @itome have pushed a fix for this as part of React Native Firebase, could you try af43576 locally and let me know how you get on, thanks - no modifications to RN needed. If all is well this will be part of Tuesday's v4.3.0 release. Side thought as well, not sure how this will look on iOS and if it's also an issue there? Loving
|
@Salakar Thank you for fixing. I downloaded the commit and every thing works well in my local computer!! |
@Salakar I'll give it a try here in a bit, thanks for making that by the way. If I had the time I would've tried to push something up but oh well. |
Fixed it! Thanks for all the help! @Salakar |
@0paIescent @itome no worries! 4.3.0 will be released later today. Thanks for testing 👌 Loving
|
@0paIescent @itome thanks for your help on this, the fix is now live in the v4.3.0 release. Loving
|
Target Platform: Android
OS: Solus 3.9999
Build Tools: 27.0.3
RN: 0.55.4
RNFirebase: 4.2.0
Issue:
When running
firebase.auth().signInAndRetrieveDataWithCredential()
, the app crashes. But it only crashes when I pass in a credential fromfirebase.auth.TwitterAuthProvider.credential()
. It works just fine when I run it with a Facebook or Google credential, but it doesn't like the one from Twitter.Code:
Both the token and secret are coming back from twitter just fine, and the credential is created properly too, so I'm not quite sure what else the issue could be. I can post any other files if needed to identify the problem, just let me know and I'll add them as soon as I can.
The text was updated successfully, but these errors were encountered: