Firebase秘密身份验证返回空有效内容 [英] Firebase secret authentication returning null payload

查看:155
本文介绍了Firebase秘密身份验证返回空有效内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用了 ref.authWithCustomToken(),但返回的有效内容具有空属性:auth,expires,token,uid。除了提供者属性设置为自定义。 authData 对象具有 null 值。更有趣的是它的不是说登录失败!,它的说法有效载荷验证成功:null

这是什么原因?

  var ref = new Firebase(kRootRefURL); 
ref.authWithCustomToken($ {
console.log(Login Failed!,error);
} else {
console.log(Authenticated successful with payload:,authData);
}
});

我额外设置了一个 onAuth()监听器只需将 authData 记录到控制台,但也是 null

解决方案

authData 引用auth。凭据有效负载(通常是JSON Web令牌),通常会在 auth 变量的安全规则中显示,用于限制对Firebase的读/写访问。 / p>

使用秘密进行身份验证时,没有有效负载,因此 null -value authData ,尽管经过身份验证。


I used ref.authWithCustomToken(), but the payload that is returned has null properties: auth, expires, token, uid. Except for the 'provider' property which is set to 'custom'. The authData object has null values. What is more curious is its not saying "Login Failed!", its saying Authenticated successfully with payload: null.

What is the reason for this?

var ref = new Firebase(kRootRefURL);
ref.authWithCustomToken(kSecret, function(error, authData) {
  if (error) {
    console.log("Login Failed!", error);
  } else {
    console.log("Authenticated successfully with payload:", authData);
  }
});

I took an additional step set an onAuth() listener to just log the authData to the console but it, too, is null.

解决方案

The authData refers to the auth. credential payload (usually a JSON Web Token), which would normally show up in your security rules under the auth variable, for use in restricting read / write access to your Firebase.

When authenticating with a secret, there is no payload and thus the null-value authData, despite being authenticated.

这篇关于Firebase秘密身份验证返回空有效内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆