nuxt-auth-utils icon indicating copy to clipboard operation
nuxt-auth-utils copied to clipboard

[Question]: When is the session server side available? Initial authorized api request possible?

Open silvio-e opened this issue 9 months ago • 3 comments

I call my endpoint /api/countries which is doing a request to an external API which needs info from the session. That works fine.

But when I call my api route on the initial loading of the app, for example in app.js in a callOnce, it seems that the session is not available yet.


// This seems not to work

await callOnce(async () => {
  const result = await $fetch('/api/countries')
})

Am I doing something wrong or is this correct behavior?

The idea was to fetch data and filling the store on app load. How can this be achieved with using a token from the authentication?

silvio-e avatar May 16 '24 16:05 silvio-e