【发布时间】:2021-01-19 02:34:42
【问题描述】:
我正在尝试访问我的 nuxt 应用程序中的一个页面,其中用户位于动态路由上。在这条路线上,他有可能登录,然后应该被重定向到完全相同的路线。对于身份验证,我想使用 auth0 策略。
我认为以下行会起作用:
this.$auth.loginWith('auth0')
.then(() => {
this.$router.push("/the-same-route-im-already-on");
})
但显然我只被重定向到我的主路由“/loggedin”。并将我的 nuxt.config 中的主页重定向更改为 false,将我重定向到我的回调路由“/login”
现在我的 nuxt.config.js 看起来像这样:
auth: {
auth0: {
...
},
redirect: {
login: '/',
logout: '/',
callback: '/login',
home: '/loggedin',
}
}
【问题讨论】:
标签: vue.js authentication nuxt.js auth0