Deleting user profile from firestore database along with Firebase Auth

OK. What you can do for now is to get the flow function that let’s you get firebase user details from the market, jus type firebase on the flow function market, you’ll see it. Then use that function to get the UId and store it as an app variable. Then use that ID as a custom id for your Firestore document.

Use the link below, it will show you how to post and patch with a custom id

@F_ORTELL I don’t know what is going wrong with me here…I am tired of running behind this.

Can you figure out the issue from the screenshot

Set request body as a formula and as :

{

“fields”: {

         "firstname": {"stringValue": "hello"} ,
         "lastname": {"stringValue": "world"} 

      }  

}

Populate the fields that what you need

Sorry for the detailed query, I am new to this @F_ORTELL

In my request body, “fields” replaced by my firestore database collection name and inside the “fields”, properties that matches the schema of the database collection, am I right?
I guess you look into my flow functions and all are correct except your point above…

Um new to Ths too, um jus trying my best … I struggled to get it working, but once you’re done with Ths, it gets better :sweat_smile:.

You need to generate the request body manually try to match the schema…You’ll get it working

Still the same… @F_ORTELL Manually set the request body in two different ways… Screenchot bellow

Sign-up user working fine but no record is creating on my data base. Is there any mistake in flow function or request body.

Also tried this format request body bellow… still the same.

{userInfo:{"userName": pageVars.userInfo.userName , "userEmail": pageVars.userInfo.userEmail , "userPassword": pageVars.userInfo.userPassword , "useridToken": pageVars.userInfo.useridToken , "uselocalId": pageVars.userInfo.userlocalId}}

Please please help me to get out of this..

Use the url below in your http request and put your firebase info, change projectname and collection name…in Ths case is (Myappgyverproject and Users)

“https://firestore.googleapis.com/v1/projects/MyappgyverProject/databases/(default)/documents/Users/”+appVars.uid

Set method to patch.

Leave header as it is.

Request body… The body structure is like Ths :

{

“fields”: {

             "firstname": {"stringValue": "hello"} ,
             "lastname": {"stringValue": "world"}
                } 

}

Try sending the above body to firebase,if you manage, you can create you own

Fields is a key word… So yours has to be something like ths ::


{

“fields”: {


             "userName": {"stringValue": "hello"} ,
             "userEmail": {"stringValue": "world"}, 
             "AddMore" :{"stringValue" :"variable"} 

           }  

}

I hope it helps

I made exactly what you say in your post above… still the record is not creating while sign up with new email… Sign-up flow works then send verification mail also user added in firebase authentication with UID… all set. But the user record is not creating on data base now.

I think biding each field “stringValues” with my pageVars properties maakes problem here. What do you say… any other suggestions?

I took the appVars UID’s value binding screenshot above to make sure you that it is correct.

Before following your instructions, I tried using create record flow function with support of pageVars object with properties… it create record on firebase with random Document ID.

Appreciate your support @F_ORTELL

I don’t get why yours is not working…

I did mine like ths.

1, I enabled firebase Auth on my appgyver project.

2, I then used a http request to sign up a user with email and password

3, now, when the user login,I use getcurrentuser function to get UId, then I redirect the user to account page to fill up user details.(username, etc)

4, when the user finish, I save the details in Firestore users and UId as the custom ID using http request.

… Are you able to create records in firestore using HTTP request function?

Try sending hard coded values to Firestore, if it works then you can try adding variables

The points 1 & 2 are same as like you in my project.
But the third point, there is different than yours…Let me elaborate.

In my case, when an user register(sign-up) on my app, he needs to provide a Name+email id + Password and hit enter to register. Am using Firebase Rest API HTTP request to register user here. You can see Sign-Up HTTP flow function on the screenshots above.

I connected the next flow function Get current user to the signup flow then assign the output of get current user to a appVars UID with value uid from the output. Then your part comes… HTTP request with PATCH… to create record on my firebase DB.

Is am on the right path @F_ORTELL ?

Yes you’re on the right path, what need is to be able to create any record n firestore using http request… If can manage that, then you can add custom keys to the request and the body.just do a simple record to send. That way you’ll know where the problem is. Also make a toast that shows response code or message.

I think you understand wrong(because of my poor explanations). I didn’t create record using HTTP request, I said that I can create request by using “Create Record” flow function by adding Data Variable, but in this case document ID of my record is generated automatically by firestore itself @F_ORTELL

OK,now I get it, you can’t set custom id to records using create records flow function for now, it only works with http request.

Instead of create record flow function, use http request…

Set url as

“https://firestore.googleapis.com/v1/projects/MyappgyverProject/databases/(default)/documents/Users/”+appVars.uid

Method as patch

Request body as


{

“fields”: {

             "firstname": {"stringValue": "hello"} ,
             "lastname": {"stringValue": "world"}
                } 

}

Send it to Firestore and tell me what it says or does

That’s what I did here Deleting user profile from firestore database along with Firebase Auth - #16 by Bravo_Moossa

I am just telling you that I am able create record using create record flow function that create record using auto document ID…

But the HTTP request with PATCH method from your instruction wont work in my App, that’s what I am saying to you. If it works, then only I can create document in firebase with Document ID as UID like you said. @F_ORTELL

ok, I can try that also. I have one more doubt @F_ORTELL

Do I need to create record first using HTTP request POST method and then again use another HTTP request with PATCH method to set the custom ID to the record?

1 Like

No, patch is a better way, it creates and updates at the same time…
If you don’t have a record, it creates it, if it is there, it updates it

Maybe there’s something wrong with the code I sent,but I can’t test it coz I left my pc. However, you use http request to send data with custom id… Look for other posts talking about setting custom id in the forum, um sure you can find something.

No, it was perfect code that you share…

I did it @F_ORTELL Thank you very much for your support, really appreciate that.
The problem is with my appVars, use toast on all the node to track the flow. Then I realize that they stop at appVar that I has set before HTTP request. Digging on that I got the solution and fixed the issue.

Now I can create or update record using PATCH method with custom ID. Thanks again.