How can I skip login page if already authenticated?

I’ve implemented the authorization process following the official vue js example. The app flow is as follows:

Register in the Initial.vue via Auth0 lock → Callback is called → User’s redirected to /home.

Once the user’s registered and in the /home I want him to be able to access all the other routes if authenticated and if not he should be prompted to login again. This works fine except for the below case:

When the user’s already registered and trying to manually access the /login instead of instantly getting redirected to/home he stays in login. I’ve tried having a beforeEnter route but auth.isAuthenticated fails due to the tokenExpiry being null (even-though user’s authenticated).

What am I missing here? Is there another approach to this?

My beforeEnter function is this:
{
path: ‘/’,
name: ‘initial’,
component: () => import(‘@/views/Initial’),
meta: {isAuth: true},
beforeEnter: ((to, from, next) => {
if (to.matched.some(record => record.meta.isAuth)) {
console.log(auth.isAuthenticated());
// Code never gets past if clause due to tokenExpiry checked in isAuthenticated() being null
if (auth.isAuthenticated()) {
console.log(‘IN beforeEnter isAuthenticated’);
next({
path: ‘/home’,
query: {redirect: to.fullPath}
})
} else {
next()
}
// }
})
}

Hey there!

Sorry for such huge delay in response! We’re doing our best in providing you with best developer support experience out there, but sometimes our bandwidth is not enough comparing to the number of incoming questions.

Wanted to reach out to know if you still require further assistance?