JWW
JWW
Explore posts from servers
BABetter Auth
Created by JWW on 3/28/2025 in #help
Session type after using admin
Hello everyone, I just implemented admin plugin for role-based authorization Then I changed user's role type to enum How can I also make this change to session type return from useSession? By customizing session?
2 replies
BABetter Auth
Created by JWW on 3/27/2025 in #help
SignOut function doesn't immediately re-invoke session change
Hi, everyone I am currently implement auth in my project I followed the quick start from docs and it went smoothly But when I implement sign out and click it, it doesn't immediately show logged out display instead I have to reload the page to see the change? Here's my auth.ts file:
import { headers } from "next/headers";
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";

import { db } from "@/db";
import { user, account, session, verification } from "@/db/schema/user";
import { env } from "@/env";

export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema: {
user: user,
account: account,
session: session,
verification: verification,
},
}),
socialProviders: {
google: {
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_CLIENT_SECRET,
},
},
});

export const currentUser = async () => {
const session = await auth.api.getSession({
headers: await headers(),
});

return session?.user;
};
import { headers } from "next/headers";
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";

import { db } from "@/db";
import { user, account, session, verification } from "@/db/schema/user";
import { env } from "@/env";

export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema: {
user: user,
account: account,
session: session,
verification: verification,
},
}),
socialProviders: {
google: {
clientId: env.GOOGLE_CLIENT_ID,
clientSecret: env.GOOGLE_CLIENT_SECRET,
},
},
});

export const currentUser = async () => {
const session = await auth.api.getSession({
headers: await headers(),
});

return session?.user;
};
Thx for anyone's help!!!
14 replies
DTDrizzle Team
Created by JWW on 12/10/2023 in #help
push command didn't update schema to my database (truso)
No description
3 replies
DTDrizzle Team
Created by JWW on 12/7/2023 in #help
Two problems about SQLite
Hello, I am now using drizzle + turso in my new side project, and I encountered two problems: 1. I have a table storing several users data, and if I want to add new column to increase user’s attribute, how can I add it but without deleting all the existing data? 2. I have to table users and tasks, how can I define schema to define a new column in users call “ownTasks” which is an array of several tasks?
2 replies