Lord Vermin
Need help understanding server context
I need to communicate with an API that requires authentication every so often. I need to hide the API from the client so I am using Nuxt server API routes to proxy any requests. What I would like to do is read the authentication token from a server-only variable on each of these routes, and grab a new token automagically if it is expired. My first thought was to use a simple util like this:
I am struggling a bit understanding the documentation and have the following questions:
1. Is it possible to create a
utils
folder under /server
and if so will this utility file be accessible client side?
2. Is there any possibility the token could be leaked to the browser?
3. Is there a better solution? This doesn't feel great to be honest.1 replies