不必要的身份验证令牌请求Firebase Web

时间:2020-04-02 16:26:24

标签: reactjs google-cloud-firestore firebase-authentication

嘿,我使用带有响应前端的Firebase javascript sdk来实现身份验证和查询Firestore数据,我最近更新了我的云安全规则,以允许只对经过身份验证的用户进行读和写操作,当我遇到的问题是不必要的令牌请求时,使用此网址(securetoken.googleapis.com/v1/token?key=xxx)从chrome网络标签中的firestore中查询数据,请帮助我。

身份验证代码:

 googleSignIn() {
firebase
  .auth()
  .setPersistence(firebase.auth.Auth.Persistence.NONE)
  .then(function() {
    var provider = new firebase.auth.GoogleAuthProvider();
    // In memory persistence will be applied to the signed in Google user
    // even though the persistence was set to 'none' and a page redirect
    // occurred.
    return firebase
      .auth()
      .signInWithEmailAndPassword('myemail.com', 'mypassword');
  })
  .catch(function(error) {
    // Handle Errors here.
    var errorCode = error.code;
    var errorMessage = error.message;
  });

用于查询数据的代码:

getData() {
const db = firebase.firestore();
db.collection('Questions/Easy/QuestionsData')
  .get()
  .then(snapshot => {
    console.log(snapshot.docs);
  });

}

我到处搜索,我认为唯一可能的是取消订阅身份验证列表,但不知道实现它的方式。

Network tab screenshot

0 个答案:

没有答案