burnstony#1975
burnstony#19756mo ago

Convex Auth - Expo React Native

trying to use convex auth following the instructions https://labs.convex.dev/auth/config/oauth LOG __clerk_client_jwt was used 🔐 │ LOG __clerk_client_jwt was used 🔐 │ ERROR TypeError: Cannot read property 'signIn' of undefined import { StyleSheet, View, Text, TouchableOpacity, Image } from 'react-native'; import { RFValue } from 'react-native-responsive-fontsize'; import React from 'react'; import { AntDesign } from "@expo/vector-icons"; import { useAuthActions } from "@convex-dev/auth/react"; import { makeRedirectUri } from "expo-auth-session"; import { openAuthSessionAsync } from "expo-web-browser"; const redirectTo = makeRedirectUri(); const LoginScreen = () => { const { signIn } = useAuthActions()
OAuth - Convex Auth
Relations, default values, unique fields and more for Convex
19 Replies
burnstony#1975
burnstony#1975OP6mo ago
@erquhart I started a new thread, I am trying to use Convex Auth
erquhart
erquhart6mo ago
Hard to help troubleshoot without better info than this.
burnstony#1975
burnstony#1975OP6mo ago
I found my way to this which maybe will help https://authjs.dev/getting-started/authentication/oauth
OAuth Providers
Authentication for the Web
burnstony#1975
burnstony#1975OP6mo ago
OAuth - Convex Auth
Relations, default values, unique fields and more for Convex
burnstony#1975
burnstony#1975OP6mo ago
Set Up Convex Auth - Convex Auth
Relations, default values, unique fields and more for Convex
OAuth - Convex Auth
Relations, default values, unique fields and more for Convex
burnstony#1975
burnstony#1975OP6mo ago
import { useAuthActions } from "@convex-dev/auth/react"; ... const LoginScreen = () => { const { signIn } = useAuthActions() ERROR TypeError: Cannot read property 'signIn' of undefined
Michal Srb
Michal Srb6mo ago
Set Up Convex Auth - Convex Auth
Relations, default values, unique fields and more for Convex
burnstony#1975
burnstony#1975OP6mo ago
thanks, I had done it but imported it incorrectly, still getting some errors, but I'll look into those and get back to this channel if I am blocked, also trying to listen to the recording from todays workshop @Michal Srb Are there convex equivalents to SignedIn, SignedOut, ClerkLoading import { ClerkLoading, SignedIn, SignedOut } from '@clerk/clerk-expo';
Michal Srb
Michal Srb6mo ago
I also cover it in the workshop
burnstony#1975
burnstony#1975OP6mo ago
Thank you finished watching the workshop OK, I think I have google and github set up for oauth with a react native app However, for both github and google, the oauth popup works, than I got through the process and after I login the popup is still open and has the following error inside the auth popup code":"[Request ID: 2f0e914be80a882b] Server Error: Uncaught Error: Invalid redirectTo exp://192.168.6.35:8081 for configured SITE_URL: http://localhost:3000","trace":"Uncaught Error: Invalid redirectTo exp://192.168.6.35:8081 for configured SITE_URL: http://localhost:3000\n at defaultRedirectCallback (../../../../node_modules/@convex-dev/auth/dist/server/implementation.js:1168:0)\n at redirectAbsoluteUrl (../../../../node_modules/@convex-dev/auth/dist/server/implementation.js:1153:4)\n at <anonymous> (../../../../node_modules/@convex-dev/auth/dist/server/implementation.js:388:40)\n at invokeFunction (../../../../node_modules/convex/src/server/impl/registration_impl.ts:81:2)\n at invokeHttpAction (../../../../node_modules/convex/src/server/impl/registration_impl.ts:424:0)\n at q.invokeHttpAction [as invokeHttpAction] (../../../../node_modules/convex/src/server/impl/registration_impl.ts:450:9)\n at HttpRouter.runRequest (../../../../node_modules/convex/src/server/router.ts:319:16)\n"} @Michal Srb any thoughts
Michal Srb
Michal Srb6mo ago
You have to correct implement the redirect callback
Michal Srb
Michal Srb6mo ago
If you go here: https://labs.convex.dev/auth/config/oauth#add-sign-in-button and click on React Native it describes how
OAuth - Convex Auth
Relations, default values, unique fields and more for Convex
burnstony#1975
burnstony#1975OP6mo ago
Thank you I was confused by this part ‘If you need to support multiple redirectTo URL schemes or origins, you must override the redirect callback, for example:’ I read that as saying you only had to implement if you are supporting multiple call backs got Github and Google working in DEV for the React Native App, now I need to get Apple in DEV and PROD for all three
burnstony#1975
burnstony#1975OP6mo ago
now updating the web half of my project that is based on the monorepo any thoughts on what to do for this https://github.com/get-convex/turbo-expo-nextjs-clerk-convex-monorepo/blob/main/apps/web/src/middleware.ts import { authMiddleware } from "@clerk/nextjs"; export default authMiddleware({ publicRoutes: ["/"], }); export const config = { matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"], };
GitHub
turbo-expo-nextjs-clerk-convex-monorepo/apps/web/src/middleware.ts ...
Monorepo template with Turborepo, Next.js, Expo, Clerk, Convex - get-convex/turbo-expo-nextjs-clerk-convex-monorepo
Michal Srb
Michal Srb6mo ago
Next.js support is being worked on
burnstony#1975
burnstony#1975OP6mo ago
Oh - that would explain the weird build errors Trying to use Convex Auth in prod now. THe GItHub login now opens and just just immediately while it works in DEV
burnstony#1975
burnstony#1975OP6mo ago
resolved, the newer version fixed this