When authenticating with Google OAuth in react native, I'm getting the error 400 saying : There was an error processing your request. Please check the input and try again.
Type general_bad_request
is the anyway to fix this ??
as on the following image.
and bellow is the code
export async function login() {
try {
// const redirectUri = Linking.createURL("*/");
// const failureUri = Linking.createURL("myapp://sign-in");
const redirectUri = Linking.createURL("myapp://redirect");
const failureUri = Linking.createURL("myapp://sign-in");
const response = await account.createOAuth2Token(
"google" as OAuthProvider.Google,
// OAuthProvider.Google,
redirectUri,
failureUri
);
if (!response) throw new Error("Create OAuth2 token failed 1");
const browserResult = await openAuthSessionAsync(
response.toString(),
redirectUri
);
console.log({ browserResult });
if (browserResult.type !== "success")
throw new Error("Create OAuth2 token failed 2");
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;
}
}
I've tried what worked before and new method but unseccessfull.
Please if there is someone with the solution, could you share >
Worked before? Oauth2 for react native isn't fully supported yet
Recommended threads
- Custom domain for Google Auth
Hello! I connected my custom domain to my Appwrite project, but I can't get the Google login/consent screen to show my domain instead of the Appwrite domain. I...
- [SOLVED] Production down - createExecuti...
Hey, Since 1.9.6 rollout in fra (~17:00 UTC, 14 Aug), POST /v1/functions/{functionId}/executions returns a 400 whenever the body includes an empty headers ob...
- Quota not resetting
hi, im using appwrite's free tier plani hit my read limts last month and the billing cycle said it would reset on june 4th but that is today, the billing cycle ...