Back

Google login on mobile devices.

  • 0
  • Auth
  • Web
  • Cloud
aliyorulmazdev
11 Aug, 2024, 19:17
TL;DR
Developers experienced issues with Google login on mobile devices. They solved it by adding a custom domain. They needed to ensure the URI was correct and update the callback URL. Adding a missing 'v1' in the endpoint URL solved a 404 error. They needed to update the app to use the correct endpoint. The issue may be related to a 3rd party cookie problem; a custom domain can solve this. Additionally, they might need to prototype on a mobile device to troubleshoot effectively.
Steven
11 Aug, 2024, 19:21

What's your code?

Can you check the network and console logs?

You might be running into a 3rd party cookie problem. To solve that, you need a custom domain

aliyorulmazdev
11 Aug, 2024, 19:25

Can I do that on mobile ?

Steven
11 Aug, 2024, 19:25

Why not?

aliyorulmazdev
11 Aug, 2024, 19:26

Im not experienced with IOS device (safari) F11. Is there any way can i prototype that on my PC ?

Steven
11 Aug, 2024, 19:30

Prototype what?

aliyorulmazdev
11 Aug, 2024, 19:30

I added custom domain appwrite.peksai.com

Steven
11 Aug, 2024, 19:30

And did you update your app to use that for your endpoint?

aliyorulmazdev
11 Aug, 2024, 19:31
TypeScript
  const handleGoogleLogin = async () => {
    setLoading(true);
    setError(null);
    setSuccess(null);

    try {
      await authService.googleLogin(); // Ensure this returns a promise
    } catch (err) {
      setError(err.message || "Google giriş başarısız. Lütfen tekrar deneyin.");
    } finally {
      setLoading(false);
    }
  };

--
  googleLogin = () => {
    return AuthService.account.createOAuth2Session(
      "google",
      "http://www.peksai.com/",
      "http://www.peksai.com/login"
    );
  };
aliyorulmazdev
11 Aug, 2024, 19:31

Not atm, can you tell me how to do that?

aliyorulmazdev
11 Aug, 2024, 19:32
TypeScript
client
  .setEndpoint("https://cloud.appwrite.io/v1")
  .setProject("");

i assume i need to change this right? to https://appwrite.peksai.com ?

aliyorulmazdev
11 Aug, 2024, 19:33
aliyorulmazdev
11 Aug, 2024, 19:38

https://appwrite.peksai.com/account GETS 404 not found atm.

aliyorulmazdev
11 Aug, 2024, 19:38
Steven
11 Aug, 2024, 19:38

You're missing the v1

aliyorulmazdev
11 Aug, 2024, 19:39
aliyorulmazdev
11 Aug, 2024, 19:40

It gives not allowed atm.

aliyorulmazdev
11 Aug, 2024, 19:41

do i need to add new api route here ?

aliyorulmazdev
11 Aug, 2024, 19:41
aliyorulmazdev
11 Aug, 2024, 19:45

Ok i think i need to change callback url on there instead.

Steven
11 Aug, 2024, 19:45

The URI should be the same except for the hostname/domain

aliyorulmazdev
11 Aug, 2024, 19:47

It works on PC now. Need to test it on mobile tho

aliyorulmazdev
11 Aug, 2024, 19:47

Its fixed.

aliyorulmazdev
11 Aug, 2024, 19:47

Custom domain solved it. thank you.

aliyorulmazdev
11 Aug, 2024, 19:55
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