Search code examples
firebasegoogle-cloud-firestorenuxt.jsfirebase-security

Firebase Firestore changing phone numbers


I have been working with Firebase for over a year now. Today I did some testing and suddenly, Firebase changes phone numbers instantly to random numbers. I want to save the phone number as a string into Firestore, but everytime I update the Document of the Firestore, the phone number String is converted into a random number.

Can someone explain this to me? Is it becaue of the GDPR or privacy stuff?

Before updating the Doc:

before updating the document

After updating the Doc (input: 06601234567) , it becomes a random number (71032704):

phone number in my Nuxt app after updating the Doc

I am working on a Nuxt Project.


Solution

  • Update: I implemented a wrong way of nullchecking in my updateDoc function. I wanted to set the telefonnummer field to null, if there was no input from the user. Apparently, it didn't work.

      await updateDoc(doc(db, 'test', userid), {
    
                  //Input: 066012345678
    
                  // Firestore --> -77123412
                  telefonnummer: this.telefonnummer | null,
    
                  // Firestore --> 066012345678 --> nice
                  telefonnummer: this.telefonnummer,