Firebase Impersonate User?

1,535 views
Skip to first unread message

Robert Duchnik

unread,
Apr 22, 2017, 6:45:10 PM4/22/17
to Firebase Google Group
It it possible to impersonate a user with Firebase authentication? For instance in traditional app I could be logged in as an admin and have access to login as a user by the users id or email.


Mike McDonald

unread,
Apr 23, 2017, 1:44:26 PM4/23/17
to Firebase Google Group
Two ways of doing this, both requiring a trusted server (it would be pretty silly for us to allow untrusted clients to impersonate another user):
A third way would be writing your Database/Storage security rules such that admins can perform extra actions. Here's an example for the Database:

{
  "rules": {
    "users": {
      "$userid": {
        ".read": "auth.uid == userid || auth.token.isAdmin == true"
      }
    }
  }
}

Thanks,
--Mike
Reply all
Reply to author
Forward
0 new messages