Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/430.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript firebase登录完成后,如何将用户重定向到配置文件/任何页面?_Javascript_Node.js_Firebase - Fatal编程技术网

Javascript firebase登录完成后,如何将用户重定向到配置文件/任何页面?

Javascript firebase登录完成后,如何将用户重定向到配置文件/任何页面?,javascript,node.js,firebase,Javascript,Node.js,Firebase,我已经对我的node js应用程序实施了firebase身份验证。应用程序需要授权令牌才能发回页面内容,否则忽略。我可以将window.location设置为应用程序配置文件页面,并使页面呈现良好状态。但要添加授权标题,我不能将页面加载为浏览器中呈现的主页,我不喜欢document inner html/Similor的替换方法,因为它感觉很便宜,我想替换页面或将用户发送到其他页面 要添加auth头,我使用JS中的xmlHttpRequest。一切正常。现在我需要在浏览器上呈现此页面。我该怎么做

我已经对我的node js应用程序实施了firebase身份验证。应用程序需要授权令牌才能发回页面内容,否则忽略。我可以将
window.location
设置为应用程序配置文件页面,并使页面呈现良好状态。但要添加授权标题,我不能将页面加载为浏览器中呈现的主页,我不喜欢document inner html/Similor的替换方法,因为它感觉很便宜,我想替换页面或将用户发送到其他页面

要添加auth头,我使用JS中的xmlHttpRequest。一切正常。现在我需要在浏览器上呈现此页面。我该怎么做

检索测试配置文件页面的代码:

 xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
        // Typical action to be performed when the document is ready:
            console.log(xhttp.responseText);
            //window.location =  xhttp.responseText; //*** I get the output but How to show page?
        }
    };
    xhttp.open("GET", "http://localhost:5000/profile/", true);
    xhttp.setRequestHeader("Authorization", "Bearer "+tokens);

    xhttp.send();
我这样做对吗?我没有找到更好的方法将auth头添加到请求中。如果可以的话,如何在浏览器上轻松显示页面