【发布时间】:2020-12-18 02:15:53
【问题描述】:
我正在尝试在使用快速服务器中间件的 Nuxt 应用中实现本地登录。
我正在使用以下模块
- nuxt 身份验证
- axios
- 护照,本地护照,本地护照猫鼬,护照会话
- 快速会话
但是,一旦我在我的应用程序中设置了 nuxt auth,整个应用程序似乎停止响应。我无法访问我的应用程序的任何页面(甚至登录和注册页面)。 运行服务器一段时间后,这就是我所看到的。 https://i.stack.imgur.com/pl0Li.png
auth: {
redirect: {
login: "/login", // User will be redirected to this path if login is required.
home: "/", // User will be redirect to this path after login. (rewriteRedirects will rewrite this path)
logout: "/login", // User will be redirected to this path if after logout, current route is protected.
user: "/user",
callback: "/",
},
strategies: {
local: {
endpoints: {
login: {
url: "/api/login",
method: "post",
propertyName: "token",
},
logout: { url: "/api/logout", method: "post" },
user: { url: "/", method: "get", propertyName: "user" },
},
tokenRequired: true, //True by default
tokenType: "bearer",
// globalToken: true,
// autoFetchUser: true
},
},
},
根据https://github.com/nuxt-community/auth-module/issues/286#issuecomment-461138282,向服务器中间件发出请求是否会导致此错误?
我应该有一个单独的 api 服务器吗?
【问题讨论】:
标签: axios passport.js nuxt.js