Salumsu
Salumsu
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Y7YA on 8/11/2024 in #questions
Server actions in server components
up
6 replies
TTCTheo's Typesafe Cult
Created by Hobbs on 8/13/2024 in #questions
T3 Next Auth / TRPC Documentation is outdated
I just put it inside server/auth just like t3, and Im also using drizzle. I think that you need to add the adapter when you want to use oauth. You can integrate it with trpc middleware by going to /server/api/trpc.ts then import auth from your nextauth.
import { auth } from "../auth";
export const createTRPCContext = async (opts: { headers: Headers }) => {
const session = await auth();

return {
db,
session,
...opts,
};
};
import { auth } from "../auth";
export const createTRPCContext = async (opts: { headers: Headers }) => {
const session = await auth();

return {
db,
session,
...opts,
};
};
just like this, and it will be available on the ctx. here's how you create a protected procedure
export const protectedProcedure = t.procedure
.use(timingMiddleware)
.use(({ ctx, next }) => {
if (!ctx.session?.user) {
throw new TRPCError({ code: "UNAUTHORIZED" });
}

return next({
ctx: {
...ctx,
session: { ...ctx.session, user: ctx.session.user },
},
});
});
export const protectedProcedure = t.procedure
.use(timingMiddleware)
.use(({ ctx, next }) => {
if (!ctx.session?.user) {
throw new TRPCError({ code: "UNAUTHORIZED" });
}

return next({
ctx: {
...ctx,
session: { ...ctx.session, user: ctx.session.user },
},
});
});
5 replies
TTCTheo's Typesafe Cult
Created by Hobbs on 8/13/2024 in #questions
T3 Next Auth / TRPC Documentation is outdated
I just didn't choose authjs in the cli and followed auth js documentation. Maybe you could do the same?
5 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
nah, wans't really referring to t3 hahahaa. Its just an expression out of frustration. I did some research and I think my problem isn't caused by t3 at all, its because of the adapter just not having the right type.
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
This sucks dude haahahha
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
No description
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
No description
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
are you talking about the npx auth secret?
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
Can someone please teach me
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
I mean, how do you even use next auth properly? the setup in t3 app is different compared to what I'm used to.. the NextAuth is returning any, how do I get the handlers, signIn, signOut, etc.?
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
have you added the client id and secret id?
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
how did you do that?
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
same dude, I have no idea how to fix it
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
I did use it
27 replies
TTCTheo's Typesafe Cult
Created by Salumsu on 7/30/2024 in #questions
T3 App type error
haven't touched anything, its the default t3 app with next auth and drizzle
27 replies