NuxtN
Nuxt12mo ago
Leander

useFetch will return "401 Unauthorized" on inital load

Hi, I am currently developing a frontend application using nuxt. The backend is made using ASP.NET and currently running in a docker container. When I login to my account in the backend, the login is saved in a cookie and this works fine. However when i use useFetch, I get 401 Unauthorized at first but when i go back and forth between the pages without reloading, I get the result I want. Just not on the initial load. The error goes away when I set server to false but I still only get the proper response when going back and forth between the pages.
Was this page helpful?