Magic Link on Expo

I'm having trouble making it work and had a look at the expo plugin implementation. It tries to parse the cookie from the onSuccess hook but that hook fires when the email is sent not after verification. So the plugin actually doesn't receive session token - it just calls the callback URL. Am I missing something?
const { signIn } = createAuthClient({
baseURL: process.env.EXPO_PUBLIC_BETTER_AUTH_URL,
plugins: [
expoClient({
storage: SecureStore,
}),
magicLinkClient(),
],
});
const result = await signIn.magicLink(
{
email: email.trim(),
callbackURL: '/',
},
{
onSuccess: (ctx) => {
const setCookie = ctx.response.headers.get('set-cookie');
console.log('set-cookie', setCookie);
},
},
);
const { signIn } = createAuthClient({
baseURL: process.env.EXPO_PUBLIC_BETTER_AUTH_URL,
plugins: [
expoClient({
storage: SecureStore,
}),
magicLinkClient(),
],
});
const result = await signIn.magicLink(
{
email: email.trim(),
callbackURL: '/',
},
{
onSuccess: (ctx) => {
const setCookie = ctx.response.headers.get('set-cookie');
console.log('set-cookie', setCookie);
},
},
);
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?