
Hello everyone i am trying to login with ios and android in react native - expo but it is not successful. And this is the code which i am using to login

app.json: { "expo": { "scheme": "doko" } }

import { Client, Account, OAuthProvider } from "appwrite"; import { makeRedirectUri } from 'expo-auth-session' import * as WebBrowser from 'expo-web-browser';
const appwriteClient = new Client() .setEndpoint('https://app.doko.so/v1') .setProject('682f5edd0032dee5da20') .setPlatform('com.dokocorp.doko');
const appwriteAccount = new Account(appwriteClient);
const signInWithIos = async () => { try { console.log("appwriteAccount", appwriteAccount);
// Custom redirect scheme
const redirectUri ="https://doko";
// Tạo deep link với expo-auth-session
const deepLink = new URL(makeRedirectUri({}));
console.log("deepLink", deepLink);
const scheme = `${deepLink.protocol}`;
console.log("scheme", scheme);
// Tạo OAuth2 token URL từ Appwrite
const loginUrl = await appwriteAccount.createOAuth2Token(
OAuthProvider.Apple,
`${deepLink}/success`,
`${deepLink}`,
);
console.log("loginUrl", loginUrl);
// Mở WebBrowser cho login
const result = await WebBrowser.openAuthSessionAsync(
`${loginUrl}`,
scheme
);
console.log("result", result);
if (result.type === "success" && result.url) {
const url = new URL(result.url);
const secret = url.searchParams.get("secret");
const userId = url.searchParams.get("userId");
if (secret && userId) {
// Tạo session
await appwriteAccount.createSession(userId, secret);
Alert.alert("✅ Login success!");
} else {
Alert.alert("🚨 OAuth failed", "Cannot get secret/userId");
}
} else {
Alert.alert("❌ Login fail");
}
} catch (err: any) { console.error(err); Alert.alert("⚠️ Error", err.message || "Something went wrong"); } };

I have configured all the files, I followed the doc, but when calling WebBrowser.openAuthSessionAsync, it does not use the deepLink created from the code
Recommended threads
- Appwrite realtime stopped working all of...
In our production environment, Appwrite Realtime suddenly stopped working and no updates are coming through , can you confirm if there are any known issues?
- Create platform and can not connect ping
I created a new platform but when I cloned the source, I didn't see the lib/... folder, only env. Then I created a .env file and added those files, then pinged ...
- Row with the requested ID already exists...
I’m hitting a blocking issue creating rows in Appwrite (both from the console and my React Native app). After successfully inserting the first row, every subseq...
