Middleware on the client side?
Is it possible to make the middleware run on the client side?
I need it to check authentication towards another service.
6 Replies
Sure! You can add a middleware like usual https://nuxt.com/docs/guide/directory-structure/middleware and then just ask for if (process.client)
But that’s not going to work when you’re in SSR mode I suppose
So the question is why you only want to check authentication on the client. This will likely cause hydration issues.
this is because im using a cms seperated from the nuxt app
the access_token/refresh_token (or auth cookies) are also set on the cms domain and not on the nuxt domain
@Attacler/Bart Okay, check out if the solution I described works for you
Will let you know, thanks so far!
it works, thanks 🙂
Nice! Glad I could helped