Error 400Invalid success param: URL host must be one of: localhost, cloud.appwrite.io, appwrite.io,
- 0
- React Native
export const client = new Client(); client .setEndpoint(config.endpoint!) .setProject(config.projectId!) .setPlatform(config.platform!);
export const avatar = new Avatars(client); export const account = new Account(client); export const databases = new Databases(client); export async function login() { try { const redirectUri = Linking.createURL('/');
const response = await account.createOAuth2Token(
OAuthProvider.Google,
redirectUri
);
console.log(response)
if (!response) throw new Error("Create OAuth2 token failed");
const browserResult = await openAuthSessionAsync(
response.toString(),
redirectUri,
);
//console.log(browserResult);
if (browserResult.type !== "success")
throw new Error("Create browser 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;
}
}
it was woking fine on npx epo start but when i made it to an apk i got this error please help
FYI, it's best to wrap code in backticks to format a bit nicer. You can use 1 backtick for inline code (https://www.markdownguide.org/basic-syntax/#code) and 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting).
OAuth2 with React Native is not fully supported. The GitHub comment explains the current state: https://github.com/appwrite/sdk-for-react-native/issues/34#issuecomment-2654940715
Recommended threads
- DB Relational Table Request
Hi, I'd like to suggest a rewording of the relationships between tables. - Current wording: storeOperatingDays can contain one storeId ...
- Domain is already used. Please try again...
I have a website with where the www.domain.me This website works just fine But if I try to visit domain.me. I get this error. I keep getting sent to some app ri...
- Redirect from clicking team invite link ...
Hi all! Pretty new to app development in general so this might be something more generic than appwrite, but I've found (after reading the docs for the Teams API...