Skip to content

Commit 1bd0013

Browse files
omar-bearivan-dalmet
authored andcommitted
feat: add expo plugin and trusted origins to auth configuration for start ui native expo
1 parent 21c63bf commit 1bd0013

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

app/server/auth.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { betterAuth } from 'better-auth';
22
import { prismaAdapter } from 'better-auth/adapters/prisma';
33
import { admin, emailOTP, openAPI } from 'better-auth/plugins';
44
import { match } from 'ts-pattern';
5+
import { expo } from '@better-auth/expo';
56

67
import {
78
AUTH_EMAIL_OTP_EXPIRATION_IN_MINUTES,
@@ -17,13 +18,15 @@ import { permissions } from '@/features/auth/permissions';
1718
import { db } from '@/server/db';
1819
import { sendEmail } from '@/server/email';
1920
import { getUserLanguage } from '@/server/utils';
21+
import { inferAdditionalFields } from 'better-auth/client/plugins';
2022

2123
export type Auth = typeof auth;
2224
export const auth = betterAuth({
2325
session: {
2426
expiresIn: envServer.SESSION_EXPIRATION_IN_SECONDS,
2527
updateAge: envServer.SESSION_UPDATE_AGE_IN_SECONDS,
2628
},
29+
trustedOrigins: ['start-ui-native://', 'start-ui-native://*'],
2730
database: prismaAdapter(db, {
2831
provider: 'postgresql',
2932
}),
@@ -46,7 +49,9 @@ export const auth = betterAuth({
4649
disableImplicitSignUp: !AUTH_SIGNUP_ENABLED,
4750
},
4851
},
52+
4953
plugins: [
54+
expo(),
5055
openAPI({
5156
disableDefaultReference: true, // Use custom exposition in /routes/api/openapi folder
5257
}),

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"@base-ui-components/react": "1.0.0-alpha.8",
4545
"@bearstudio/ui-state": "1.0.2",
4646
"@fontsource-variable/inter": "5.2.6",
47+
"@better-auth/expo": "1.2.10",
4748
"@headlessui/react": "2.2.2",
4849
"@hookform/resolvers": "5.0.1",
4950
"@orpc/client": "1.5.2",

pnpm-lock.yaml

Lines changed: 17 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)