Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.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
Node.js 如何在用户成功登录/注册后将用户发送到用户仪表板_Node.js_Express_Authentication_Jwt_Xmlhttprequest - Fatal编程技术网

Node.js 如何在用户成功登录/注册后将用户发送到用户仪表板

Node.js 如何在用户成功登录/注册后将用户发送到用户仪表板,node.js,express,authentication,jwt,xmlhttprequest,Node.js,Express,Authentication,Jwt,Xmlhttprequest,我有一个注册表格(里面没有定义action attr)。我正在使用XHR请求将json格式的formData发送到express上运行的后端。在我从请求调用的api中,我生成了json web令牌以进行进一步身份验证,并将其发送回xhr响应,我将其存储在localStorage中 现在,我想将用户发送到用户配置文件页面,该页面将填充其详细信息。怎么做 我尝试做的一件事是在前一个xhr请求的响应中创建另一个xhr请求,并将其发送到位于auth中间件前面的另一个api,但我无法使用inf res.r

我有一个注册表格(里面没有定义action attr)。我正在使用XHR请求将json格式的formData发送到express上运行的后端。在我从请求调用的api中,我生成了json web令牌以进行进一步身份验证,并将其发送回xhr响应,我将其存储在localStorage中

现在,我想将用户发送到用户配置文件页面,该页面将填充其详细信息。怎么做

我尝试做的一件事是在前一个xhr请求的响应中创建另一个xhr请求,并将其发送到位于auth中间件前面的另一个api,但我无法使用inf res.render()从该api呈现我的userprofile页面/视图,因为它是由xhr请求触发的

请指导我如何进行或向其他人展示如何进行

编辑:-

我尝试使用window.location.href将用户导航到其配置文件页面,但问题是我无法为jwt设置身份验证标题,因此用户将永远无权查看其配置文件

建议另一种方法