如何使用JavaScript获取firebase 3的accessToken [英] How to get accessToken for firebase 3 using javascript

查看:116
本文介绍了如何使用JavaScript获取firebase 3的accessToken的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


















$ b $ var authKey = ref.getAuth()。token;
var s = firebaseUrl +'/.json?shallow=true&auth='+ authKey;
$ http.get(s)

现在如何使用firebase 3来执行此操作?

解决方案

firebase.auth()。signInWithEmailAndPassword(u,p).then (result){

result.getToken()。then(function(token){
$ rootScope.userLoginToken = token;
});

});


I need to make a shallow rest call using javascript with firebases REST Api, in the past version I needed to pass the access token like this:

    var authKey = ref.getAuth().token;
    var s = firebaseUrl + '/.json?shallow=true&auth=' + authKey;
    $http.get(s)

How do I do this now with firebase 3?

解决方案

firebase.auth().signInWithEmailAndPassword(u, p).then(function(result){

    result.getToken().then(function(token){
        $rootScope.userLoginToken = token;
    });

});

这篇关于如何使用JavaScript获取firebase 3的accessToken的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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