Back

[SOLVED] Auth network request failed

  • 0
  • Web
elnur
23 Oct, 2023, 17:33

These errors occur on a development server with networking enabled.

npm run dev -- --host

ERROR Sign-in error: 0 Network request failed ERROR Sign-in error: 0

I have a custom domain as _APP_DOMAIN and I have changed the environment variables in the docker container which it runs on.

It works on desktop, just not mobile.

TL;DR
User is having an issue with authentication network request failing on mobile, but it works on desktop. They followed a guide on implementing it in React. They changed environment variables to a custom domain and the hostname has an A record pointing to the droplet's public IPv4 address. The error occurs on a development server with networking enabled. The issue is specific to mobile, as it works on desktop. Solution: One-click install doesn't run from source, so running `npm run dev` wouldn't work. The user should check if their mobile phone is connected to the same network as the appwrite instance. If not, that could be
Drake
23 Oct, 2023, 17:36

Where are you running this?

elnur
23 Oct, 2023, 17:43

One click install on a digital ocean droplet.

I changed the environment variables to the custom domain.

_APP_DOMAIN _APP_TARGET_DOMAIN _APP_FUNCTIONS_DOMAIN

I don’t remember exactly the variable names but those are the ones I changed to a hostname. The hostname has an A record pointing to the droplet public ipv4 address on my DNS on porkbun.

The weird thing is that it works on desktop which has localhost:5173 but it doesn’t work on the same development server over the network, eg 192.168.XX.XX:5173

Drake
23 Oct, 2023, 18:14

one-click install doesn't run from source so you wouldn't be running npm run dev 🧐

elnur
23 Oct, 2023, 18:27

You're right, it's running on the droplet just fine. I can reach the dashboard and everything works.

The thing I'm having this issue with is when I'm using the JavaScript SDK to handle authentication on the client side. It works on desktop but not on mobile.

I followed your guide on how to implement it on React. Again, works on desktop not on mobile.

Drake
23 Oct, 2023, 18:30

you mean mobile browser?

is your mobile phone connected to the same network as your appwrite instance?

Drake
23 Oct, 2023, 18:30

oh wait...this is a CORS error

Drake
23 Oct, 2023, 18:30

you need to add a web platform to your project where the hostname is whatever your app is running on

Drake
23 Oct, 2023, 18:30

so 192.168.XX.XX

elnur
23 Oct, 2023, 18:50

Great we got that sorted... so I just add new platforms for each hostname its going to be interacted with?

elnur
23 Oct, 2023, 18:51
elnur
23 Oct, 2023, 21:22

Thanks! It worked 👍

Drake
24 Oct, 2023, 00:33

[SOLVED] Auth network request failed

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more