Firebase以管理员身份进行身份验证 [英] Firebase authenticate as admin

查看:140
本文介绍了Firebase以管理员身份进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以作为Firebase的管理员对Firebase进行身份验证,以便对其进行完全的读/写访问(已经有保护部分的安全规则),还是必须编写一个安全规则,以某种方式允许我访问完整的firebase,例如通过提供一个特定的密码/密钥。



是否有一个标准的或建议的方式来做到这一点?

解决方案



authWithCustomToken现在是signInWithCustomToken(firebase版本3.x)

文档示例:

  firebase.auth()。signInWithCustomToken(token).catch(function (error){
//处理错误
var errorCode = error.code;
var errorMessage = error.message;
if(errorCode ==='auth / invalid -cus tom-token'){
alert('您提供的令牌无效');
} else {
console.error(error);
}
});


Is there a way I can authenticate with Firebase as an administrator of a firebase for full read/write access to it (already has security rules protecting parts of it), or will I have to write a security rule that somehow allows me access to the full firebase, for example by providing a certain password/key.

Is there a standard or suggested way of doing this?

解决方案

See this for the 'latest' documentation.

authWithCustomToken is now signInWithCustomToken (firebase version 3.x)

Example from the documentation:

firebase.auth().signInWithCustomToken(token).catch(function(error) {
    // Handle Errors here.
    var errorCode = error.code;
    var errorMessage = error.message;
    if (errorCode === 'auth/invalid-custom-token') {
        alert('The token you provided is not valid.');
    } else {
        console.error(error);
    }
});

这篇关于Firebase以管理员身份进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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