Skip to content
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

Cant OAuth2 when on testflight #34

Open
schoolofai opened this issue Oct 10, 2024 · 1 comment
Open

Cant OAuth2 when on testflight #34

schoolofai opened this issue Oct 10, 2024 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@schoolofai
Copy link

schoolofai commented Oct 10, 2024

hi i am having issues with using google oauth for login - I am using react native sdk - it all works when on expo go , but when i installed it to testfight it stops working - and when trying to login with google - in get invalid sucess param should be one of - localhost .... etc . here is my sign in code -

    let redirectUri = makeRedirectUri({ preferLocalhost: true });
    console.log("Redirect URI:", redirectUri);

    const url = await account.createOAuth2Token(
      "google",
      redirectUri,
      redirectUri,
      [
        "profile",
        "email",
        "https://www.googleapis.com/auth/youtube",
        "https://www.googleapis.com/auth/youtube.force-ssl",
        "https://www.googleapis.com/auth/youtube.upload",
        "https://www.googleapis.com/auth/youtubepartner",
      ]
    );
    console.log("URL:", url);
    if (!url) {
      throw new Error("Failed to create OAuth2 session");
    }

    const result = await openAuthSessionAsync(url.href, redirectUri);
    console.log("Auth session result:", result);

    if (result.type === "success") {
      if ("url" in result) {
        const resultUrl = new URL(result.url);
        const secret = resultUrl.searchParams.get("secret");
        const userId = resultUrl.searchParams.get("userId");
        if (!secret || !userId) return;
        await account.createSession(userId, secret);
        const user = await account.get().catch((e) => {
          console.warn(e);
          return null;
        });
        console.log("user:", user);

see the screen shot for google cloud credentials
ImageImage

@eldadfux eldadfux transferred this issue from appwrite/appwrite Oct 24, 2024
@stnguyen90 stnguyen90 transferred this issue from appwrite/sdk-generator Oct 28, 2024
@stnguyen90 stnguyen90 added the question Further information is requested label Oct 28, 2024
@stnguyen90
Copy link
Contributor

@schoolofai, thanks for creating this issue! 🙏🏼 Could you please share exactly what the redirectUri is when running via TestFlight? It's likely the hostname in the URL hasn't been registered in your Appwrite project yet.

@stnguyen90 stnguyen90 self-assigned this Oct 28, 2024
@stnguyen90 stnguyen90 changed the title React Native SDK - Cant Auth when on testflight Cant Auth when on testflight Oct 28, 2024
@stnguyen90 stnguyen90 changed the title Cant Auth when on testflight Cant OAuth2 when on testflight Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants