'How to remove the access rights to a linked google account after the deletion of an account at firebase?

I just implemented the possibility to delete the personal account at Firebase of an Android application. I then discovered that the application is still listed on the Google account with having access rights even though the Firebase account is already deleted.



Solution 1:[1]

If you have implemented the option to sign in your users to Firebase with Google, then most likely you already have followed these steps:

According to:

I just implemented the possibility to delete the personal account at Firebase of an Android application.

If you have only deleted the Firebase authentication account it doesn't mean that everything related to Google is wiped out, because it's not.

To achieve what you want, I recommend you follow the below steps in the exact order I have added:

  1. Sign-out the user from Google using SignInClient#signOut() method.

Signs out the currently signed-in user if any.

  1. Delete the Firebase user account using FirebaseUser#delete() method:

Deletes the user record from your Firebase project's database. If the operation is successful, the user will be signed out.

  1. Delete all data in Cloud Firestore using DocumentReference#delete(), or the Realtime Database using DatabaseReference#removeValue(), if it exists.

So in the case of 2. there is no need to explicitly sign out the user from Firebase because when you delete the account, the user will be signed out automatically.

P.S. Please also remember that all three operations are asynchronous. So you need to wait until the operations are complete. In java, you can use a LiveData object and in Kotlin you can use Kotlin Coroutines.

Edit:

Regarding FirebaseUser#unlink(String provider) method, it only:

Detaches credentials from a given provider type from this user.

I have even written an article regarding this topic:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1