stefandjokicS
Convex Community8mo ago
2 replies
stefandjokic

I see "`auth:store` type: signIn" on Convex, but nothing happens on the frontend (React Native)

Hi everyone! I'm running a self-hosted Convex instance, which seems to have partially working authentication.

For instance, when I sign up as a new user (I'm only using the basic email+password strategy), and I try to sign up again with the same email, I get an error saying that the email already exists.

However, after the successful sign up AND after trying to sign in, it seems that everything was fine on the BE / Convex side, but nothing happens on the mobile app. What could be wrong?

_layout.tsx
:

const convex = new ConvexReactClient(process.env.EXPO_PUBLIC_CONVEX_URL!, {
  unsavedChangesWarning: false,
})

const secureStorage = {
  getItem: SecureStore.getItemAsync,
  setItem: SecureStore.setItemAsync,
  removeItem: SecureStore.deleteItemAsync,
}

export default function RootLayout() {
  return (
    <ConvexAuthProvider
      client={convex}
      storage={
        Platform.OS === "android" || Platform.OS === "ios"
          ? secureStorage
          : undefined
      }
    >
      <Stack>
        <Stack.Screen name="index" />
      </Stack>
    </ConvexAuthProvider>
  )
}


index.tsx:

export default function Index() {
  const submissions = useQuery(...)

  return (
    <SafeAreaView style={homeStyles.container}>
      <ScrollView contentContainerStyle={homeStyles.scrollContainer}>
        <Authenticated>
      *** UNREACHABLE CODE ***
          </View>
        </Authenticated>
        <Unauthenticated>
      *** THIS COMPONENT ALWAYS STAYS ON THE SCREEN ***
          <SignIn />
        </Unauthenticated>
      </ScrollView>
    </SafeAreaView>
  )
}
Was this page helpful?