React-native-firebase: Can't read from database after migrating from Web SDK

Created on 10 May 2018  路  2Comments  路  Source: invertase/react-native-firebase

Issue

After seeing all the perks of using this package I decided to switch from the 'firebase' library which I was using to implement the Web SDK for Auth and Realtime Database. I followed all the steps and everything is up and running, but I am running into one nasty problem which is rendering this library useless for me until I can find a fix. Auth works and writing to the database works (users get updated as having signed in), but the application cannot read from the database, so I remain stuck on the login screen as it can't load the user profile. I'm receiving the following error: Database: Client doesn't have permission to access the desired data. It's especially confusing given the client ability to write to database, and none of my rules or anything have changed. I removed the web app initialization code, followed all the right steps as far as I can tell, and really have searched exhaustively for a fix and tried everything I can think of. Help is very much appreciated.

My rules are as follows. They have been this way the whole time and working wonderfully til this point:
{ "rules": { "users": { "$uid": { ".read": "$uid === auth.uid", ".write": "$uid === auth.uid" } } } }

Environment

  1. Application Target Platform: iOS

  2. Development Operating System: macOS High Sierra

  3. Build Tools: Xcode

  4. React Native version: 0.50.0

  5. RNFirebase Version: 4.1.0 (scaled back from 5 due to current compatibility issues)

  6. Firebase Module: Database and Auth

Most helpful comment

@kevinEsherick for some reason, and rather confusingly, Google have done this:

1) v4.x: Introduced the withData methods and deprecated the original methods
2) v5.0: Changed the original methods to have the same method signature as the withData methods and deprecated the withData methods.

That's why you're seeing the mixed messages - we're compliant with v4.x of the firebase JS - we'll be switching over to the v5 API at some point in the near future.

All 2 comments

Turns out it was due to switching from signInWithEmailAndPassword to signInAndRetrieveDataWithEmailAndPassword. I was previously using the former, received a warning that it was deprecated and I have to switch to the latter. Now I checked Google's docs and they say the opposite, that the latter is deprecated and to use to former. So not really sure what the deal is there with the mixed messages, but switching back to the former fixes the inability to read from database. Might open another issue to suggest clarifying this warning message

@kevinEsherick for some reason, and rather confusingly, Google have done this:

1) v4.x: Introduced the withData methods and deprecated the original methods
2) v5.0: Changed the original methods to have the same method signature as the withData methods and deprecated the withData methods.

That's why you're seeing the mixed messages - we're compliant with v4.x of the firebase JS - we'll be switching over to the v5 API at some point in the near future.

Was this page helpful?
0 / 5 - 0 ratings