skip to Main Content

Using Admin-sdk, Is there a way to delete a particular provider from a user record in firebase?

For eg:
Assume a given user has the following providers linked to his account

  1. password
  2. google.com
  3. facebook.com

Say, I would like to revoke the user’s ability to login via facebook to his account. Can this be done using admin sdk.

I could only find an api to unlink a provider (which is client side api. This will require the firebase-issued-idToken of the user).

2

Answers


  1. Chosen as BEST ANSWER

    Not sure when this ability was added in admin sdk, but it seems in version 8.1.0 you can achieve this using the following:

    UserRecord.UpdateRequest updateRequest = new UserRecord.UpdateRequest(ssoId);
    // remove/unlink social login providers
    updateRequest.setProvidersToUnlink(Arrays.asList("google.com", "facebook.com", "apple.com"));            
    
    FirebaseAuth.getInstance().updateUser(updateRequest);
    

  2. I don’t think there’s an API to unlink a provider in the Admin SDK. It does exist in the REST API, but there too it seems to only exist for the current user.

    But I also don’t think it would help much, as the user can always call the API to link that provider with your configuration data – even if your application code doesn’t. So while it is useful to be able to unlink a provider from your code, it won’t be a permanent revoke, which seems to be what you’re after. That would only be possible for all users by disabling the Facebook provider completely.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search