How to make Firebase Functions act as a user instead of being an admin?

后端 未结 3 1235
一整个雨季
一整个雨季 2020-12-20 15:29

My client app is accessing to Firestore through API created by Firebase Functions. However, the Firebase Functions imports firebase-admin which bypass all the d

3条回答
  •  太阳男子
    2020-12-20 15:41

    I think it is possible to access Firestore via an admin-sdk but scope it to the logged-in user if you are use REST APIs to access Firestore.

    For authentication, the Cloud Firestore REST API accepts either a Firebase Authentication ID token or a Google Identity OAuth 2.0 token. The token you provide affects your request's authorization:

    Use Firebase ID tokens to authenticate requests from your application's users. For these requests, Cloud Firestore uses Cloud Firestore Security Rules to determine if a request is authorized.

提交回复
热议问题