sdk-generator icon indicating copy to clipboard operation
sdk-generator copied to clipboard

React Native SDK - Cant Auth when on testflight

Open schoolofai opened this issue 1 year ago • 0 comments

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

schoolofai avatar Oct 10 '24 09:10 schoolofai