FeathersJS / Nuxt / SSR Authentication
Authenticated requests within nuxtServerInit
When using Nuxt
you are at some point going to require to make authenticated requests to your server from within the Nuxt
server process. With thanks to Marshall Thompson this is a solution to authenticate the feathers-client
on the server.
Here is the store/feathers-client.js
here we export feathersClient
function.
Within the store/index.js
we are creating a feathersClient
for the browser and the server. This is so we can run the initAuth
method which will authenticate the client and all requests made within the Nuxt
context will now be authenticated.
I hope this helps and if you see anything which could be changed or improved please get in touch or leave a comment.