简体   繁体   English

执行get request firebase时出错,error: 'Unauthorized request in Angular

[英]Error while executing get request firebase, error: 'Unauthorized request in Angular

my rules are as bellow我的规则如下

database in firebase firebase 中的数据库

this is where im calling api url这是我打电话给 api url 的地方

在此处输入图像描述 i am trying to fetch data from firebase api in angular but facing 'Unauthorized request error, i tried for post req as well, tried in another service and component as well but it still the same.我正在尝试从 angular 中的 firebase api 中获取数据,但遇到“未经授权的请求错误”,我也尝试了 post req,也尝试了另一个服务和组件,但它仍然相同。 i simply added one json file to firebase and trying to fetch in my project.我只是将一个 json 文件添加到 firebase 并尝试在我的项目中获取。

Navigate to your Firebase console, and copy your project Firebase Config.导航到您的 Firebase 控制台,并复制您的项目 Firebase Config。 Then pass it to the initializeApp method.然后将其传递给 initializeApp 方法。 For example, this implementation shows Google Auth:例如,此实现显示 Google Auth:

const app = initializeApp(firebaseConfig);

        const auth = getAuth(app);
        useDeviceLanguage(auth);

        const provider = new GoogleAuthProvider();

        const R = await signInWithPopup(auth, provider);

To find your Firebase Config, go to thislink , then select your project.要找到您的 Firebase 配置,go 到此链接,然后 select 您的项目。 Now go to the bottom (your apps section), select the config option from the SDK setup and configuration menu, and copy it.现在 go 到底部(您的应用程序部分),select SDK 设置和配置菜单中的配置选项,然后复制它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 安装 firebase @angular/fire 时出错 - Error while installing firebase @angular/fire 使用 firebase.User 方法从 firebase angular 项目获取登录用户的用户名时出错 - Getting error while using firebase.User method to get username of logged in user from firebase angular project Firebase 错误:错误(auth.network-request-failed - Firebase error : Error (auth/network-request-failed 添加新应用程序时,如何在 Firebase 控制台中解决此错误? “处理请求时出现未知错误。请重试。” - How do I get past this error in the Firebase console when adding a new app? "There was an unknown error while processing the request. Try again." Firebase:本地主机上的错误(auth/unauthorized-domain) - Firebase: Error (auth/unauthorized-domain) on localhost Vue: Firebase Auth REST API throws 400 Bad Request Error - Vue: Firebase Auth REST API throws 400 Bad Request Error Sendy“与 Amazon SNS 通信时出错 API:执行此请求时出现问题” - Sendy 'Error communicating with Amazon SNS API: There was a problem executing this request' [FirebaseError: Firebase: 错误 (auth.network-request-failed) - [FirebaseError: Firebase: Error (auth/network-request-failed) Firebase 登录时出现“Auth.network-request-failed”错误的项目结果 - Firebase Project Results in "Auth/network-request-failed" error on login Firebase Jest auth.network-request-failed'错误 - Firebase Jest auth/network-request-failed' error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM