Firestory Security Rules: Block Anonymous User

July 22, 2019

Block anonymouse user from write.

match /item/{item_id} {
    allow read: if request.auth.uid != null;
    allow write: if request.auth.uid != null && request.auth.token.firebase.sign_in_provider != 'anonymous';
}

NOTE: Refer auth. Possible values for request.auth.token.firebase.sign_in_provider includes custom, password, phone, anonymous, google.com, facebook.com, github.com, twitter.com.

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.