#Convex Auth - Capacitor Based web and mobile app
4 messages · Page 1 of 1 (latest)
I'm sorry for returning late.
Streaming for web works fine as in video.
The same flow exits the application on the capacitor and opens the browser. I couldn't show it in the video, but the user is asking again and cannot redirect.
It seems like we need to open the browser within the application, not externally.
I think we need to use a library like @capacitor/browser (like expo-auth-session used for React native)
const handleSignIn = async () => {
const { redirect } = await signIn("github", { redirectTo });
if (Platform.OS === "web") {
return;
}
const result = await openAuthSessionAsync(redirect!.toString(), redirectTo);
if (result.type === "success") {
const { url } = result;
const code = new URL(url).searchParams.get("code")!;
await signIn("github", { code });
}
};
I could not find how to solve the flow in the code sample in a capacitor application.