NuxtN
Nuxt14mo ago
Nisthar

How to pass data from plugins to server api endpoint in nuxt 3?

I have a module in my nuxt app. It uses a plugin to auto refresh tokens if its expired (both on client side and on server load). I need to extend this and after refreshing tokens, fetch the user data and pass it to the app's server api endpoints. How do i do that?

I have tried adding middleware into the module. It seems like middlewares are good solution but it runs before the plugin. so it doesn't get the refreshed token to fetch the user.

Does anyone have a solution to this issue?
Was this page helpful?