#Convex Auth - Capacitor Based web and mobile app

4 messages · Page 1 of 1 (latest)

lean orchid
#

Hey! I assume you mean OAuth didn't work. How does it fail?

It might be a while before we get to optimizing the library for Capacitor, but contributions are welcome!

finite wasp
#

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.