Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to delete currentUser firebase authentication user?

I used firebase_auth package to work with flutter. And I used phone authentication to sign in. Everything is working well. But when signout user is not deleted on firebase.

Is it possible to delete firebase user?

 RaisedButton(
    onPressed: () async {
         await FirebaseAuth.instance.signOut();
    }
 )

I tried this way, but error is coming..

delete called null

    _auth.onAuthStateChanged.listen((currentUser)=>{
             currentUser.delete()
}).onError((e)=>print("Error is $e"));
like image 886
BIS Tech Avatar asked Sep 13 '25 17:09

BIS Tech


1 Answers

Yes. You must use FirebaseAuth.instance.currentUser.delete() method before (on) signOut() method.

RaisedButton(
    onPressed: () async {
        FirebaseAuth.instance.currentUser.delete();
        await FirebaseAuth.instance.signOut();
    }
)
like image 128
Serdar Polat Avatar answered Sep 16 '25 08:09

Serdar Polat