Rectangle 27 4

The code in the above snippet is correct, but the address / URL of the Firebase being used is incorrect. All 'production' user Firebases use the domain firebaseIO.com, but the above code uses a firebaseIO-demo.com domain, which is security-disabled and used only for test purposes. Firebases on that domain can be created by anyone and passed around as a convenience, but cannot be authenticated to or tied to a Firebase account.

Regarding passwords in plaintext, all Firebase Simple Login requests are forced to HTTPS, so this password is never actually sent in plaintext over the wire.

Firebase simple login does not return a user object - Stack Overflow

firebase firebase-security
Rectangle 27 4

In retrieveData(), you should be using a ChildEventListener, not a ValueEventListener. You are adding Node objects as children of node/$uid with the keys generated by push(). The ValueEventListener is returning a Map<String,Object> containing all of the Nodes. That is shown in the logcat output you posted. You can use the onChildAdded() callback of ChildEventListener to get each Node as it is created and then add it to your adapter.

I am still having problems adding the collected data to the listview via the adapter. What else am I missing? I have adjusted the code to what you suggested. Check the update.

What behavior are you seeing now? Not seeing the error message any longer? Do you have a log statement in onChildAdded() to confirm that it is firing?

says it's caused by the line with the code for NodeObject nodeObject = datasnapshot.getValue(NodeObject.class);

Use the Firebase console to examine the value and nodes/$uid to confirm that it has children that are Nodes. Is there possibly some old data leftover from previous runs? If so, you can use the console to delete the extraneous values.

android - No setter/field for warning Firebase Database Retrieve Data ...

android firebase firebase-database
Rectangle 27 3

Projects that are created at firebase.google.com, can only use the Firebase Authentication SDKs available from https://firebase.google.com/docs/auth/.

You're using a Firebase 2.x SDK, specifically this createUser() method.

The fact that you're including a dependency on the new Firebase is not enough, you likely also have a dependency on Firebase for Android 2.x somewhere (e.g. compile 'com.firebase:firebase-client-android:2.5.2+'), which you'll need to remove.

If you already have an existing project on the legacy Firebase console, you can continue to use that with the 2.x SDKs. But projects that are created at firebase.google.com, can only use the Firebase Authentication SDKs available from firebase.google.com/docs/auth.

@frank-van-puffelen This error also happens on server applications using Firebase 2. The funny part is applications create using Firebase Legacy and migrated to to Google Firebase work perfectly.

android - How to solve the error "Projects created at console.firebase...

android firebase-database firebase-authentication
Rectangle 27 0

[Disclosure: I work for Firebase] We do root for you reaching that number of course. :-)

Firebase - How many databases can be created? - Stack Overflow

firebase
Rectangle 27 0

In a typical database schema each Channel / ChatGroup has its own node with unique $key (created by Firebase). It shouldn't matter which user opened the channel first but once the node (& corresponding $key) is created, you can just use that as channel id.

Hashing / MD5 strategy of course is other way to do it but then you also have to store that "route" info as well as $key on the same node - which is duplication IMO (unless Im missing something).

I think they are doing it to preserve the information which user started the chat.

Thats true though to create the hash you sort user-names so in the end you really dont know who started that channel. If you really need this information you can just create property under your chat-channel-node. Typically if the channel has multiple users you should make someone "admin" of that channel & give few special "powers" but yeah depends on your application's needs.

javascript - Best way to manage Chat channels in Firebase - Stack Over...

javascript arrays firebase chat
Rectangle 27 0

You can link an email and password to a user account that is created via phone authentication but Firebase Auth does not enforce 2 factor authentication the next time the user signs in. The user is able to log in with either (email/password or phone) without requiring both. You will need to implement your own custom solution for this. Please file a request via Firebase support or the official Firebase Google Group for 2 factor auth.

If you wish to just verify the phone number and link it to the account but not require it next sign-in, you can after you create user with email and password, ask the user for the phone number, call:

[[FIRPhoneAuthProvider provider] verifyPhoneNumber:phoneNumber ...]

which resolves with a verificationID. You then initialize a phone auth credential after getting the SMS code:

FIRPhoneAuthCredential *credential =
    [[FIRPhoneAuthProvider provider] credentialWithVerificationID:verificationID  verificationCode:verificationCode];
[[[FIRAuth auth] currentUser] linkWithCredential:credential]

on the currentUser using the phone credential. This will add that phone number to the email/password user. You can consider it verified. The next time they sign in with email/password you can access that via user.phoneNumber.

Actually i just want the user to verify his phone number for the first time after he enter his email and pass. After that he use only his email and password

ios - Is it possible to use email and phone number to authentication i...

ios firebase swift3 firebase-database firebase-authentication
Rectangle 27 0

You can use FireBase Cloud Function to create a payload and Fire a Notification.You can handle events in the Firebase Realtime Database. The Realtime Database supports the onWrite() event, which triggers anytime data is created, destroyed, or changed in a specified database location. Please refer this tutorial for detail which may help you https://code.tutsplus.com/tutorials/serverless-apps-with-firebase-cloud-functions--cms-28557

but i cant do with firebase console ?

you need to write the cloud function locally in Node.js and deploy that with firebase.please see the sample code on github.com/firebase/functions-samples/blob/master/

ios - Handler Remote Notification background - Stack Overflow

ios objective-c firebase push-notification apple-push-notifications
Rectangle 27 0

As pointed out in the comments since users are being signed up using username + '@domain.com' Firebase will prevent duplicate usernames because it won't allow two separate users to sign up with the same email. Once your user is created you can write the username to the database and there won't be any collisions. Keep in mind that this problem can become more difficult if users are allowed to change their username. You'll have to check the newly requested username against the existing usernames to determine if the requested name already exists. Lastly, don't forget Firebase is case sensitive so you might want to cast all usernames to lower/uppercase and trim the trailing white space before you upload them.

The biggest problem I can think of is that uid's are guaranteed to be unique by Firebase so there can't be any duplicates. If you store everything by username you'll have to make sure there are no duplicate usernames when users sign up. So you have to make an area of the database that can be read from by unauthenticated users to check the requested username against existing usernames.

You have to think about how you're going to access the data most of the time. Additionally, if you denormalize the user data (store it under uid & username) you have to make sure that both copies stay in sync. It's probably easier to just store username -> uid so that you have a mapping to get to the user data if you only have the username. This isn't going to happen that often and the extra nested query isn't going to make much of a performance difference.

Won't firebase take care of the usernames being unique since I am also registering them on firebase in the format <username>@domain.com with '@domain.com' being common in all users?

That seems correct. I don't think you can create two users with the same email address. So if you write the username data after the user is created you won't have the problem of keeping usernames unique.

Use a username as key in firebase for storing users - Stack Overflow

firebase firebase-database firebase-authentication
Rectangle 27 0

You need to POJO/Custom class to efficiently write/read to a Firebase database. Idealy, you have created a class Message with setters and getters and a default constructor defined:

class Message {
  private String message;

  public Message() {
  }
  public Message(String message) {
    this.message = message;
  }

  public void getMessage() {
    return message;
  }
  public void setMessage(String message) {
    this.message = message;
  }
}
{
 "rules": {
   "message": {
    "$uid": {
      ".write": "$uid === auth.uid",
      ".read": "$uid === auth.uid"
   }
  }
 }
}

Then in your java code do this:

DatabaseReference mDatabaseReference;
FirebaseUser firebaseUser;

 mAuthListener = new FirebaseAuth.AuthStateListener() {
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            firebaseUser = firebaseAuth.getCurrentUser();
            if (firebaseUser != null) {
                // User is signed in
            } else {
                // User is signed out
            }
        }
    };
...


//To save a message associated to only the signed in user
Message message = new Message();
message.setMessage("a message");
mDatabaseReference = FirebaseDatabase.getInstance().getReference(); 
mDatabaseReference.child("message").child(firebaseUser.getUid())
     .setValue(message)
     .addOnCompleteListener(DetailsCaptureActivity.this, new OnCompleteListener<Void>() {
     ...
  });
//Set up an AuthStateListener that responds to changes in the user's sign-in state:
    mAuthListener = new FirebaseAuth.AuthStateListener() {
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            firebaseUser = firebaseAuth.getCurrentUser();
            if (firebaseUser != null) {

                   databaseReference = firebaseDatabase.getReference().child("message").child(firebaseUser.getUid());
                   databaseReference.addValueEventListener(new ValueEventListener() {
                      @Override
                      public void onDataChange(DataSnapshot dataSnapshot) {
                          Message message = dataSnapshot.getValue(Message.class);
                          //You can now get your message using message.getMessage();
                      }

                      @Override
                      public void onCancelled(DatabaseError databaseError) {

                          Log.e(TAG, databaseError.getMessage());
                      }
                  });

            } else {
                Log.e(TAG, "onAuthStateChanged:signed_out");
            }
        }
    };

You can now add your own implementation for retrieving a list of messages.Hopefully, that wouldn't be a problem.

android - How to make sure a user can only see and access their own da...

android firebase firebase-security firebase-authentication
Rectangle 27 0

Thanks to information here and here I realized I could add a Firebase account that had a "role" as an Administrator. This way, when I retrieve the uid and displayName from the QR code (the QR code must include the displayName in addition to the uid as you cannot retrieve it later even with full access to the Firebase database) I can just login as my Administrator Firebase account and I can write and read for the QR code passed in uid with the following database rule changes, please note I do have a "users" database I created and that is where I store my role:

{
  "rules": {
    "users": {
      ".read": "root.child('users').child(auth.uid).child('role').val() == 'admin'",
      ".write": "root.child('users').child(auth.uid).child('role').val() == 'admin'",
      "$uid": {
        ".read": "auth.uid == $uid",
        ".write": "auth.uid == $uid"
      }
    }
  }
}

objective c - Sharing Firebase authentication/token across two iOS app...

ios objective-c swift firebase qr-code
Rectangle 27 0

Thanks to information here and here I realized I could add a Firebase account that had a "role" as an Administrator. This way, when I retrieve the uid and displayName from the QR code (the QR code must include the displayName in addition to the uid as you cannot retrieve it later even with full access to the Firebase database) I can just login as my Administrator Firebase account and I can write and read for the QR code passed in uid with the following database rule changes, please note I do have a "users" database I created and that is where I store my role:

{
  "rules": {
    "users": {
      ".read": "root.child('users').child(auth.uid).child('role').val() == 'admin'",
      ".write": "root.child('users').child(auth.uid).child('role').val() == 'admin'",
      "$uid": {
        ".read": "auth.uid == $uid",
        ".write": "auth.uid == $uid"
      }
    }
  }
}

objective c - Sharing Firebase authentication/token across two iOS app...

ios objective-c swift firebase qr-code
Rectangle 27 0

The code in the above snippet is correct, but the address / URL of the Firebase being used is incorrect. All 'production' user Firebases use the domain firebaseIO.com, but the above code uses a firebaseIO-demo.com domain, which is security-disabled and used only for test purposes. Firebases on that domain can be created by anyone and passed around as a convenience, but cannot be authenticated to or tied to a Firebase account.

Regarding passwords in plaintext, all Firebase Simple Login requests are forced to HTTPS, so this password is never actually sent in plaintext over the wire.

Firebase simple login does not return a user object - Stack Overflow

firebase firebase-security
Rectangle 27 0

In a typical database schema each Channel / ChatGroup has its own node with unique $key (created by Firebase). It shouldn't matter which user opened the channel first but once the node (& corresponding $key) is created, you can just use that as channel id.

Hashing / MD5 strategy of course is other way to do it but then you also have to store that "route" info as well as $key on the same node - which is duplication IMO (unless Im missing something).

I think they are doing it to preserve the information which user started the chat.

Thats true though to create the hash you sort user-names so in the end you really dont know who started that channel. If you really need this information you can just create property under your chat-channel-node. Typically if the channel has multiple users you should make someone "admin" of that channel & give few special "powers" but yeah depends on your application's needs.

javascript - Best way to manage Chat channels in Firebase - Stack Over...

javascript arrays firebase chat
Rectangle 27 0

It does not seem to be produced by Firebase but by the lifecycle in Android. If activity was created and pass to background, when you go back the method onCreate won't be call, search about lifecycle on Android. Maybe you can put your code on onResume method.

Firebase notifications in android - Stack Overflow

android firebase push-notification firebase-notifications
Rectangle 27 0

Projects that are created at firebase.google.com, can only use the Firebase Authentication SDKs available from https://firebase.google.com/docs/auth/.

You're using a Firebase 2.x SDK, specifically this createUser() method.

The fact that you're including a dependency on the new Firebase is not enough, you likely also have a dependency on Firebase for Android 2.x somewhere (e.g. compile 'com.firebase:firebase-client-android:2.5.2+'), which you'll need to remove.

If you already have an existing project on the legacy Firebase console, you can continue to use that with the 2.x SDKs. But projects that are created at firebase.google.com, can only use the Firebase Authentication SDKs available from firebase.google.com/docs/auth.

@frank-van-puffelen This error also happens on server applications using Firebase 2. The funny part is applications create using Firebase Legacy and migrated to to Google Firebase work perfectly.

android - How to solve the error "Projects created at console.firebase...

android firebase-database firebase-authentication
Rectangle 27 0

You need to POJO/Custom class to efficiently write/read to a Firebase database. Idealy, you have created a class Message with setters and getters and a default constructor defined:

class Message {
  private String message;

  public Message() {
  }
  public Message(String message) {
    this.message = message;
  }

  public void getMessage() {
    return message;
  }
  public void setMessage(String message) {
    this.message = message;
  }
}
{
 "rules": {
   "message": {
    "$uid": {
      ".write": "$uid === auth.uid",
      ".read": "$uid === auth.uid"
   }
  }
 }
}

Then in your java code do this:

DatabaseReference mDatabaseReference;
FirebaseUser firebaseUser;

 mAuthListener = new FirebaseAuth.AuthStateListener() {
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            firebaseUser = firebaseAuth.getCurrentUser();
            if (firebaseUser != null) {
                // User is signed in
            } else {
                // User is signed out
            }
        }
    };
...


//To save a message associated to only the signed in user
Message message = new Message();
message.setMessage("a message");
mDatabaseReference = FirebaseDatabase.getInstance().getReference(); 
mDatabaseReference.child("message").child(firebaseUser.getUid())
     .setValue(message)
     .addOnCompleteListener(DetailsCaptureActivity.this, new OnCompleteListener<Void>() {
     ...
  });
//Set up an AuthStateListener that responds to changes in the user's sign-in state:
    mAuthListener = new FirebaseAuth.AuthStateListener() {
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            firebaseUser = firebaseAuth.getCurrentUser();
            if (firebaseUser != null) {

                   databaseReference = firebaseDatabase.getReference().child("message").child(firebaseUser.getUid());
                   databaseReference.addValueEventListener(new ValueEventListener() {
                      @Override
                      public void onDataChange(DataSnapshot dataSnapshot) {
                          Message message = dataSnapshot.getValue(Message.class);
                          //You can now get your message using message.getMessage();
                      }

                      @Override
                      public void onCancelled(DatabaseError databaseError) {

                          Log.e(TAG, databaseError.getMessage());
                      }
                  });

            } else {
                Log.e(TAG, "onAuthStateChanged:signed_out");
            }
        }
    };

You can now add your own implementation for retrieving a list of messages.Hopefully, that wouldn't be a problem.

android - How to make sure a user can only see and access their own da...

android firebase firebase-security firebase-authentication
Rectangle 27 0

In a typical database schema each Channel / ChatGroup has its own node with unique $key (created by Firebase). It shouldn't matter which user opened the channel first but once the node (& corresponding $key) is created, you can just use that as channel id.

Hashing / MD5 strategy of course is other way to do it but then you also have to store that "route" info as well as $key on the same node - which is duplication IMO (unless Im missing something).

I think they are doing it to preserve the information which user started the chat.

Thats true though to create the hash you sort user-names so in the end you really dont know who started that channel. If you really need this information you can just create property under your chat-channel-node. Typically if the channel has multiple users you should make someone "admin" of that channel & give few special "powers" but yeah depends on your application's needs.

javascript - Best way to manage Chat channels in Firebase - Stack Over...

javascript arrays firebase chat