#Redirect Uri

23 messages · Page 1 of 1 (latest)

shell helm
#

error 400 invalid success param: invalid url register your new client as a new platform on your project console dashboard general_argument_invalid buts its working in local dev

rigid ledge
#

Oauth?

shell helm
rigid ledge
shell helm
#

the problem is in the login function it works using the localhost

misty cairn
#

Did you register the domain you're using as a platform? Are you using cloud?

shell helm
#

yes lm using cloud

rigid ledge
#

Redirect uri should be appwrite-callback-<projectId

#

And next time instead of providing the whole codebase just provide the function code

shell helm
#

so how to ensure that the url is appwrite-callback-<projectId and also why is working well on localhost expo go

rigid ledge
#

Go to app.json and set the scheme as required.

#

That should do the work

shell helm
#
  try {
    const deepLink = new URL(makeRedirectUri({ preferLocalhost: true }));
    const scheme = `${deepLink.protocol}//`; // e.g. 'exp://' or 'appwrite-callback-<PROJECT_ID>://'

    const response = await account.createOAuth2Token(
      OAuthProvider.Google,
      `${deepLink}`,
      `${deepLink}`,
    );
    if (!response) throw new Error("Create OAuth2 token failed");

    const browserResult = await openAuthSessionAsync(
      response.toString(),
      scheme
    );
    if (browserResult.type !== "success")
      throw new Error("Create OAuth2 token failed");

    const url = new URL(browserResult.url);
    const secret = url.searchParams.get("secret")?.toString();
    const userId = url.searchParams.get("userId")?.toString();
    if (!secret || !userId) throw new Error("Create OAuth2 token failed");

    const session = await account.createSession(userId, secret);
    if (!session) throw new Error("Failed to create session");

    return true;
  } catch (error) {
    console.error(error);
    return false;
  }
}```  Now its failing to send a request above is my login function. I changed my scheme in my app.json scheme: "appwrite-callback-projectid"
rigid ledge
#

Any errors?

shell helm
#

failed to connect from my try and catch

rigid ledge
fleet willow
shell helm
#
      OAuthProvider.Google,
      `${deepLink}`,
      `${deepLink}`,
    );``` how arguments does this function take
misty cairn
rigid ledge
fleet willow