问题
In Firebase Auth console there is an option for each user such as Enable/Disable his account. How can I trigger this event in Firebase functions and in Android app?
回答1:
function cannot trigger on this kind of event (at least not yet) , function will only triggered in these cases (checkout the doc)
Firebase accounts will trigger user creation events for Cloud Functions when:
A user creates an email account and password.
A user signs in for the first time using a federated identity provider.
The developer creates an account using the Firebase Admin SDK.
A user signs in to a new anonymous auth session for the first time.
and also will triggered on user deletion
回答2:
This is not available via the Console. Definitely, file a request for this as Frank recommended. A native Firebase function event for enabling/disabling is also not available but you can construct that with the available tools using Firebase Admin SDK and realtime database or firestore.
You can use the disabled property to toggle this on and off via the updateUser API.
Each time the user is enabled or disabled, you update some Database node with that status (corresponding user has read access only). You can then listen to it from the Android client where the corresponding user is signed in.
来源:https://stackoverflow.com/questions/48425694/firebase-trigger-for-enable-disable-a-user