New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
401 Unauthorized when I query the same url more then once without a page request #28
Comments
also, sorry for the second issue in 2 days. Thanks for fixing the first one so fast |
This behavior may have to be revised but currently, to prevent secret tokens from leaking to clients, any tokens added via runtimeConfig or environment variables are only present on serverside. More information here
No problem at all, looking forward to your continued feedback on the module. |
Ok, and sorry for being dumb, quick question. How come the first time it requests the data it is server side and the refresh request is client side, even though they are both in my <script setup>? |
No need to apologize. In web apps which feature server side rendering, the first load along with it's requests happen on the server, where as subsequent reloads after the initial load happen within the browser. |
Thanks, v useful. One more... Is there any way for me to get those subsequent requests sent from the server? |
There may be merit in allowing the token to live authentication token to live client, though I'd developers would need to be made aware of the possible risk of exposing their secret tokens. so perhaps I can implement a |
@FWORDIE perhaps using an api route to proxy the requests to the secure API. The api route would have access to the auth token, hence the response can be made there then passed back to the client |
Thanks v much, ill go investigate |
I am trying to do call for data from my CMS with the same Token in two different places, a component(Header) and a NuxtPage(Body). One page load, both useAsyncData calls work and the page works as expected. However, if I change the NuxtPage with a NuxtLink, and hence need to fetch new data for that page, I get a '401 Unauthorized' Error from my CMS (datoCMS). I am using the refreshnuxtdata to do that data refresh and it seems like that function is not sending the token?
This seems like the most relevant code but let me know if you need more information
Things I tried
Didn't Work, even though GQL_TOKEN is in .env
Did work but seems to be a bad solution to have to add my token by hand
The text was updated successfully, but these errors were encountered: