srd
srd
BABetter Auth
Created by srd on 4/20/2025 in #help
See what provider made the session
Is there a way to see what provider triggered the session creation? I need to restrict some stuff based on which provider you used to log on due to business restrictions. Or do you have any tips for a workaround.
7 replies
BABetter Auth
Created by srd on 4/19/2025 in #help
Get user inside session hook
Is there a way to get the userinfo inside a before session databaseHook? I can't call auth.api.getSession and then read the user object as its in the initialization of auth. My goal is to automatically set the active org based on the email domain.
export const auth = betterAuth({

databaseHooks: {
session: {
create: {
before: async (session) => {
const email = user.email
const orgs = orgs
const user_org = some logic to find the correct org based on email
return {
data: {
...session,
activeOrganizationId: user_org.id
}
}
}
}
}
}
});
export const auth = betterAuth({

databaseHooks: {
session: {
create: {
before: async (session) => {
const email = user.email
const orgs = orgs
const user_org = some logic to find the correct org based on email
return {
data: {
...session,
activeOrganizationId: user_org.id
}
}
}
}
}
}
});
6 replies
BABetter Auth
Created by srd on 4/18/2025 in #help
Multiple accounts with the same e-mail
I would like users be able to have multiple accounts with the same email but with different providers. Eg, 1 magic link account and 1 social (microsoft) account. They should not be linked together. Is this possible? I just get error account_not_linked when trying to log on with microsoft when a magic link account already exists
6 replies
BABetter Auth
Created by srd on 4/18/2025 in #help
Magic link verify on a secondary device
Is there a simple / built-in way to achieve where you can verify the log on attempt from a secondary device? Eg, if you want to log onto a tv where you cant receive emails. So you could just click the link on your phone instead and the tv would be the one logged on.
3 replies