trite
trite
BABetter Auth
Created by trite on 4/9/2025 in #help
Determine if new user without callbacks in expo
import { createAuthClient } from 'better-auth/react';
import { expoClient } from '@better-auth/expo/client';
import * as SecureStore from 'expo-secure-store';
import { inferAdditionalFields } from 'better-auth/client/plugins';
import type { Auth } from '@/lib/auth';

export const authClient = createAuthClient({
// for local dev: EXPO_PUBLIC_MYAPP_API_URL=http://localhost:3000
baseURL: `${process.env.EXPO_PUBLIC_MYAPP_API_URL}/api/auth`,
plugins: [
expoClient({
scheme: 'myapp',
storagePrefix: 'myapp',
storage: SecureStore,
}),
inferAdditionalFields<Auth>({
user: {
name: { type: 'string', nullable: true },
firstName: { type: 'string', nullable: true },
lastName: { type: 'string', nullable: true },
email: { type: 'string', nullable: false },
phone: { type: 'string', nullable: true },
createdAt: { type: 'date', nullable: false },
updatedAt: { type: 'date', nullable: false },
},
}),
],
});
import { createAuthClient } from 'better-auth/react';
import { expoClient } from '@better-auth/expo/client';
import * as SecureStore from 'expo-secure-store';
import { inferAdditionalFields } from 'better-auth/client/plugins';
import type { Auth } from '@/lib/auth';

export const authClient = createAuthClient({
// for local dev: EXPO_PUBLIC_MYAPP_API_URL=http://localhost:3000
baseURL: `${process.env.EXPO_PUBLIC_MYAPP_API_URL}/api/auth`,
plugins: [
expoClient({
scheme: 'myapp',
storagePrefix: 'myapp',
storage: SecureStore,
}),
inferAdditionalFields<Auth>({
user: {
name: { type: 'string', nullable: true },
firstName: { type: 'string', nullable: true },
lastName: { type: 'string', nullable: true },
email: { type: 'string', nullable: false },
phone: { type: 'string', nullable: true },
createdAt: { type: 'date', nullable: false },
updatedAt: { type: 'date', nullable: false },
},
}),
],
});
Sorry for the delay, here's the config ^
9 replies
BABetter Auth
Created by trite on 4/9/2025 in #help
Determine if new user without callbacks in expo
The useEffect block in the opening message for this thread is the workaround I'm using. Found it in the example here: https://github.com/better-auth/better-auth/blob/main/examples/expo-example/src/app/index.tsx#L18-L24
9 replies
BABetter Auth
Created by trite on 4/9/2025 in #help
Determine if new user without callbacks in expo
const res = await authClient.signIn.social({
provider: 'google',
callbackURL: '/root',
});
const res = await authClient.signIn.social({
provider: 'google',
callbackURL: '/root',
});
I have another thread from last week that was asking about the callbacks not working (https://discord.com/channels/1288403910284935179/1355677792494288946), seems like it should be fixed at some point in the future, but for now it doesn't work.
9 replies