0

My app is for 2 types of users. I tried to use the custom claims of firebase ( https://firebase.google.com/docs/auth/admin/custom-claims#java), but the method setCustomUserClaims() is unidentified. I guess it's something with the SDK version but I do not know how to change it. Someone can help please?

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Sharon D
  • 3
  • 3

1 Answers1

0

The documentation you're looking at is for the Firebase Admin SDK, which does not work in Android apps. That's for backend code running in on a server in a secure privileged environment. If you don't have a backend to power your app, you won't be able to make use of custom claims, since they can only be set by backend code. You could also write a desktop program, but you would have to run that manually whenever you want something to change for a user.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • Is there any other way then? I need that only authorized users will be able to write to the database and that only those users will have access to some of the data. can you tell me please how can I do this? – Sharon D Apr 16 '20 at 05:36
  • My advice is in the answer. Write a program on a backend or desktop that uses the Firebase Admin SDK to assign custom claims. – Doug Stevenson Apr 16 '20 at 05:45
  • I have no idea how to do this, do you think this: https://stackoverflow.com/questions/46372780/android-firebase-different-types-of-users-login is a good solution too? – Sharon D Apr 16 '20 at 06:16