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