Retrieving session after magic link signin in Expo
Hi guys,
We've set up Better Auth server in our nextjs app and created a successfull authentication setup. Now we're trying to use that same setup for our login on our Expo mobile app. For both the platforms we use a magic link. I've followed the setup here: https://www.better-auth.com/docs/integrations/expo with a custom server.
I've managed to create a succesful login and deeplinking in the app based on the callback url looking something like this: http://localhost:3000/api/auth/magic-link/verify?token=super-secret-token-here&callbackURL=exp://192.168.1.60:8081/--/customer/(tabs)/home
But when the app navigates to that screen and I call auth.useSession(), the session is always null.
Does anyone have a clue on what I'm missing?
"@better-auth/expo": "^1.1.18",
"better-auth": "^1.1.18",
``` database: drizzleAdapter(db, {
provider: 'pg',
schema: {
user: schema.user,
session: schema.session,
account: schema.account,
verification: schema.verification,
},
}),
user: {
additionalFields: {
activeCompanyId: {
required: false,
type: 'string',
},
type: {
type: 'string',
},
language: {
type: 'string',
},
dateFormat: {
type: 'string',
},
timeFormat: {
type: 'string',
},
},
},
plugins: [
expo(),
magicLink({
disableSignUp: true,
sendMagicLink,
}),
],
trustedOrigins: ['*'], // ['exp://'],
Expo Integration | Better Auth
Integrate Better Auth with Expo.
1 Reply
Same here, did you manage to handle this?