最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - firebase admin or normal firebase with next js - Stack Overflow

programmeradmin0浏览0评论

I am working on next js project and I use it with firebase and right now I use firebase with my ponents to retrieve some data and it works perfectly - as expected - and I wanted to use firebase in getServerSideProps so I thought I should use firebase admin sdk but for fun I tried to use it with the same firebase package I used on front end and - I don't know how - it worked however the code in getServerSideProps must be a back end code so right now I don't know why does it work and If I should keep using firebase web package or switch to firebase admin package

I am working on next js project and I use it with firebase and right now I use firebase with my ponents to retrieve some data and it works perfectly - as expected - and I wanted to use firebase in getServerSideProps so I thought I should use firebase admin sdk but for fun I tried to use it with the same firebase package I used on front end and - I don't know how - it worked however the code in getServerSideProps must be a back end code so right now I don't know why does it work and If I should keep using firebase web package or switch to firebase admin package

Share Improve this question asked Feb 14, 2022 at 21:53 M7mod BakrM7mod Bakr 1771 silver badge8 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 10

The regular (client-side) SDK for Firebase can be used in Node.js too. In fact, it is the remended SDK to use in untrusted Node.js environments, such as many IoT devices.

The Admin SDKs are designed to run in trusted environments, such as your development machine, a server that you control, or Cloud Functions/Cloud Run.

If you're running the server-side for your app in such a trusted environment (which you likely are), then you can use the Admin SDK to gain access to additional administrative functionality, such as managing multiple users, full unrestricted access to the database/storage, and more.

If you don't need such functionality, you can stick to using the regular SDK.

发布评论

评论列表(0)

  1. 暂无评论