Delete a specific user from Firebase

后端 未结 4 1961
北荒
北荒 2020-11-29 08:34

Is there a way I can get a specific user account from firebase and then delete it?

For instance:

// I need a means of getting a specific auth user.
v         


        
4条回答
  •  余生分开走
    2020-11-29 08:55

    When using the client-side SDKs for Firebase Authentication, you can only delete the user account that is currently signed in. Anything else would be a huge security risk, as it would allow users of your app to delete each other's account.

    The Admin SDKs for Firebase Authentication are designed to be used in a trusted environment, such as your development machine, a server that you control, or Cloud Functions. Because they run in a trusted environment, they can perform certain operations that the client-side SDKs can't perform, such as deleting user accounts by simply knowing their UID.

    Also see:

    • delete firebase authenticated user from web application

    Another common approach is to keep a whitelist/blacklist in for example the Firebase Database and authorize user based on that. See How to disable Signup in Firebase 3.x

提交回复
热议问题