Skip to content

Logout raises error when firebase rules require auth != null access. #529

Closed
@Lecss

Description

@Lecss

What is the current behavior?
Logout raises error when firebase rules allow only authenticated user access.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar.

currently using the following firebase rules:

{
   "rules": {
     "users": {
       "$uid": {
           ".read": "auth != null && auth.uid == $uid",
       }
 }

On logout, I get the following error:
Error with profile listener: Database: Client doesn't have permission to access the desired data. (database/permission-denied). Error: Database: Client doesn't have permission to access the desired data. (database/permission-denied).

What is the expected behavior?

Logout functionality should not raise errors.

Looks this is due to the fact that in actions/auth.js , authUid is set to null before unwatching user profile. Changing the order of this solves the issue. Happy to raise a PR for this if this is confirmed as the right solution.

firebase._.authUid = null;
unWatchUserProfile(firebase);

Which versions of dependencies, and which browser and OS are affected by this issue? Did this work in previous versions or setups?

I see this behaviour in react-native, but seems to be generic one rather than react-native specific.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions