BoyHaxB
Convex Community3mo ago
1 reply
BoyHax

auth session created but login not working in client side

🔑Auth
please help i created expo convex app using better-t-stack and app was with better-auth then i changed to convex auth and added diffrent providers resend email otp ,twilio otp, email password .and in all providers the login do work in he backend and log show success and session created but login in client side still not working and isAuthunicated still false .i also done the same code in tanstack start app and same problem .

convex/auth.ts
import { Password } from "@convex-dev/auth/providers/Password";
import { convexAuth, getAuthUserId } from "@convex-dev/auth/server";
import { ResendOTP } from "./ResendOTP";
import { query } from "./_generated/server";
import { TwilioVerify } from "./TwilioVerify";
export const { auth, signIn, signOut, store, isAuthenticated } = convexAuth({
  providers: [ResendOTP,TwilioVerify,Password()],
});
export const getCurrentUser = query({
    args: {},
    handler: async (ctx, args) => getAuthUserId(ctx).then((id) => !!id ? ctx.db.get('users',id):null).catch(() => null),
});

convex/auth.config.ts
export default {
  providers: [
    {
      domain: process.env.CONVEX_SITE_URL,
      applicationID: "convex",
    },
  ],
};

expo login code attached
import { ConvexAuthProvider } from "@convex-dev/auth/react";
import { ConvexProvider, ConvexReactClient } from "convex/react";
const convexUrl = process.env.EXPO_PUBLIC_CONVEX_URL || "";
const convex = new ConvexReactClient(convexUrl, {
    unsavedChangesWarning: false,
});
export default function Layout() {
    return (
        <ConvexProvider client={convex}>

            {/* <ConvexBetterAuthProvider client={convex} authClient={authClient}> */}
            <ConvexAuthProvider client={convex}>
                                <StackLayout />


            </ConvexAuthProvider>
            {/* </ConvexBetterAuthProvider> */}
        </ConvexProvider>
    );
}
message.txt13.64KB
Was this page helpful?