Next.js Discord

Discord Forum

axios not working in nextjs on iOS mobile devices

Answered
Oriental Scops-Owl posted this in #help-forum
Open in Discord
Oriental Scops-OwlOP
hi.. i have a website that works fine on PC/Mac but on mobile devices, axios requests seem to not complete and just hang. Seems directly related to nextjs. i have the same library and calls on a generic react app and they load fine on my phone without issues.

anyone seen this before ? do i need some additional config maybe?

I use axios as my inteceptor code is written within the main axios object and im just familiar with axios versus next fetch
Answered by Oriental Scops-Owl
@riský the issue was that i needed to enable 3rd party cookies in my iOS. the login cookie comes from auth0.com domain rather than my own custom domain. i will need to upgrade my auth0 plan when going live and switch my login domain so the cookie ties back to my main domain.
View full answer

8 Replies

are you using axios on client?
firstly you should use fetch: https://www.adios-axios.com
secondly, you shouldn't use axios on the client (it was designed for nodejs not browser)
Oriental Scops-OwlOP
@riský i think its my auth0 client cookie. seems to be related to being logged in versus API call
Oriental Scops-OwlOP
@riský the issue was that i needed to enable 3rd party cookies in my iOS. the login cookie comes from auth0.com domain rather than my own custom domain. i will need to upgrade my auth0 plan when going live and switch my login domain so the cookie ties back to my main domain.
Answer
ahh that sounds logical
you should mark that as solution :derp:
Oriental Scops-OwlOP
@riský sure. how do i do that? 😄
Oriental Scops-OwlOP
ah thank you