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
@erquhart I started a new thread, I am trying to use Convex Auth
Hard to help troubleshoot without better info than this.
I found my way to this which maybe will help https://authjs.dev/getting-started/authentication/oauth
OAuth Providers
Authentication for the Web
just following the instructions here
https://labs.convex.dev/auth/config/oauth#add-sign-in-button
OAuth - Convex Auth
Relations, default values, unique fields and more for Convex
did this first https://labs.convex.dev/auth/setup
now trying to do https://labs.convex.dev/auth/config/oauth#add-sign-in-button
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
import { useAuthActions } from "@convex-dev/auth/react";
...
const LoginScreen = () => {
const { signIn } = useAuthActions()
ERROR TypeError: Cannot read property 'signIn' of undefined
Looks like you didn't follow Step 4?
https://labs.convex.dev/auth/setup#set-up-the-react-provider
Set Up Convex Auth - Convex Auth
Relations, default values, unique fields and more for Convex
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';
Authorization - Convex Auth
Relations, default values, unique fields and more for Convex
I also cover it in the workshop
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 thoughtsYou have to correct implement the
redirect
callbackIf 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
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
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
Next.js support is being worked on
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
resolved, the newer version fixed this