Utkarsh Anand
Utkarsh Anand
BABetter Auth
Created by Utkarsh Anand on 4/4/2025 in #help
How to revoke all sessions after reset password from forget password link?
this approach worked for me, i manually fetch the user email using the userId, then first login the user and then revokeOtherSesion using authClient. Thanks
5 replies
BABetter Auth
Created by Utkarsh Anand on 3/27/2025 in #help
Not able to get session type while using auth.api.getSession({headers: headers()})
thanks @bekacru for sharing the repo, i fixed the problem, it was due to the typescirpt versoin "5.2.2" i am using, when i upgraded typescirpt verison to "5.6.3" it is giving me proper types.
7 replies
BABetter Auth
Created by Utkarsh Anand on 3/27/2025 in #help
Not able to get session type while using auth.api.getSession({headers: headers()})
They are not working as i already described at first, and i am not building the internal package (auth) because it is directly used by nextjs using the transpile option. For example i have internal package which is not used in next app and i am creating the auth instance there using better-auth, then still i am not getting the types correctly. Can you share any repo link which is turborepo, nextjs@14 app router, trpc, drizzle with pg and better-auth?
7 replies
BABetter Auth
Created by Utkarsh Anand on 3/27/2025 in #help
Not able to get session type while using auth.api.getSession({headers: headers()})
My auth config is like below
export const auth = betterAuth({
// ======= Database config =======
database: drizzleAdapter(db, {
provider: "pg",
schema: {
...schema,
verification: schema.verificationToken
}
}),

// ========= Auth config =======
emailAndPassword: {
enabled: true
},
advanced: {
generateId: false
},

plugins: [magicLinkPlugin, nextCookies()]
});
export const auth = betterAuth({
// ======= Database config =======
database: drizzleAdapter(db, {
provider: "pg",
schema: {
...schema,
verification: schema.verificationToken
}
}),

// ========= Auth config =======
emailAndPassword: {
enabled: true
},
advanced: {
generateId: false
},

plugins: [magicLinkPlugin, nextCookies()]
});
But i am not sure if this is related to config, because when i tried it in some new cloned demo repo or other repo which are using better-auth, they are providing correct type of .getSession() even if i just pass an empty config like betterAuth({}). Also i have setup better-auth in an internal package of turborepo, which i used in webapp (nextjs app router) with transpilePackages: option in next.config.js. I don't know what i am missing, is it something in tsconfig or what? @bekacru
7 replies