我正在尝试使用 https:/firebase.nuxtjs.org。 作为我的项目的基础,我在认证方面遇到了问题。
这个例子使用了非常复杂的 auth
部分。
config: {
apiKey: [api-key-1],
authDomain: 'nuxt-fire-demo.firebaseapp.com',
databaseURL: 'https://nuxt-fire-demo.firebaseio.com',
projectId: 'nuxt-fire-demo',
storageBucket: 'nuxt-fire-demo.appspot.com',
messagingSenderId: '807370470428',
appId: '1:807370470428:web:26da98c86c3fd352',
measurementId: 'G-XT6PVC1D4X',
fcmPublicVapidKey:
[api-key-2]
},
然而,这样复杂的auth不应该是必需的,因为这里的例子应该更容易。
https:/firebase.google.comdocsfirestorequickstart。
const admin = require('firebase-admin');
admin.initializeApp({
credential: admin.credential.applicationDefault()
});
const db = admin.firestore();
这应该是读取服务账户信息,从 GOOGLE_APPLICATION_CREDENTIALS
.
我如何使用demo和简化auth来使用这个env var?
解决方案:
我真的很困惑,请原谅我。
1)所以你寻求的是简单的Firebase认证对吗?既然你提出了 firebase-admin
你是想把Firebase SDK带入你的网站吗?您的服务器? (都是两码事)
2)为什么选择Nuxt而不是Vue,有什么特别的原因吗,不能只用认证吧?
3)ComponentVuexStore文档的简单认证,NuxtFire。https:/firebase.nuxtjs.orgguideusage#examples。
4)NuxtFire演示(git repo和网站链接)。https:/firebase.nuxtjs.orgguidedemo。
如果我误解了你的问题,绝对欢迎。干杯
本文来自投稿,不代表运维实战侠立场,如若转载,请注明出处:https://www.shizhanxia.com/3893.html