刷新后我无法刷新页面或打开安全页面的新标签,或者新标签将重定向我重新登录
版本
Nuxt.js v2.9.1
@nuxtjs/module: 4.8.4
Run Code Online (Sandbox Code Playgroud)
安全页面
middleware: ['auth'],
Run Code Online (Sandbox Code Playgroud)
auth-module 的中间件
登录页面
middleware: ['guest'],
Run Code Online (Sandbox Code Playgroud)
中间件/guest.js
export default async function({ store, redirect }) {
// console.log(store.state.auth)
if (store.state.auth.loggedIn) {
return redirect('/')
}
}
Run Code Online (Sandbox Code Playgroud)
console.log(store.state.auth) = { 用户:空,登录:假,策略:'本地'}
nuxt.config.js
auth: {
strategies: {
local: {
endpoints: {
// register: { url: 'member', method: 'post', propertyName: 'data.accessToken' },
login: { url: 'api/authen-admin', method: 'post', propertyName: 'custom' },
user: { url: 'api/admin', method: 'get', propertyName: 'custom' },
logout: false
},
tokenRequired: 'Authorization',
tokenType: false …Run Code Online (Sandbox Code Playgroud) 我尝试使用 Nuxt Auth 模块设置谷歌身份验证,但我从谷歌收到以下错误:
Error 400 : invalid_request
Parameter not allowed for this message type: nonce
Run Code Online (Sandbox Code Playgroud)
这是我的配置
Error 400 : invalid_request
Parameter not allowed for this message type: nonce
Run Code Online (Sandbox Code Playgroud)
以及我如何在我的组件中调用 google auth:
// nuxt.config.js
modules: ["@nuxtjs/axios", "@nuxtjs/auth-next"],
auth: {
router: {
middleware: ["auth"],
},
redirect: {
login: "/login",
logout: "/",
callback: false,
home: "/",
},
strategies: {
google: { clientId: "MyClientID", codeChallengeMethod: "" }
}
}
Run Code Online (Sandbox Code Playgroud)
我也尝试从这里运行官方演示:https : //github.com/nuxt-community/auth-module/tree/dev/demo 但我遇到了同样的错误。
怎样才能像用键盘打字一样输入呢?我知道我们可以通过设置输入值来做到这一点,但是我如何才能真正模拟键盘输入呢?
以下是显示 keydown 但在输入中不键入任何内容的示例代码。
html代码:
<p>Info: <input id="info" style="width:50%"></p>
<p>show: <input id="show" style="width:50%"></p>
<p><button onclick="showType()">Type in show</button></p
Run Code Online (Sandbox Code Playgroud)
js代码:
document.addEventListener("keydown", function(ev) {
document.getElementById("info").value =
"key= "+ev.key+" : "+ev.code+" : "+ev.keyCode;
}, true);
function showType(){
document.getElementById("show").focus()
document.getElementById("show").dispatchEvent(
new KeyboardEvent("keydown", {
key: "d",
code: "KeyD",
keyCode: 68,
shiftKey: false,
ctrlKey: false,
metaKey: false
})
);
}
Run Code Online (Sandbox Code Playgroud)