Connor B
Connor B
TTCTheo's Typesafe Cult
Created by Teodorant Master Of Nonsense on 2/6/2024 in #questions
How do I setup credentials based auth with the app I created with T3 CLI?
what are your errors?
9 replies
TTCTheo's Typesafe Cult
Created by Teodorant Master Of Nonsense on 2/6/2024 in #questions
How do I setup credentials based auth with the app I created with T3 CLI?
try adding a syntax tag in the future:
import CredentialsProvider from "next-auth/providers/credentials";
import bcrypt from "bcrypt";
import prisma from "@/prisma/client";

export const authOptions = {
providers: [
CredentialsProvider({
name: "Credentials",
credentials: {
email: {
label: "email:",
type: "text",
placeholder: "your-email",
},
password: {
label: "password:",
type: "password",
placeholder: "your-password",
},
},
async authorize(credentials) {
try {
const foundUser = await prisma.user.findUnique({
where: { email: credentials!.email },
});

if (foundUser) {
console.log("User Exists");
console.log(foundUser);
const match = await bcrypt.compare(
credentials!.password,
foundUser.password
);

if (match) {
console.log("Good Pass");
foundUser.password = " ";

// foundUser["role"] = "Unverified Email";
return foundUser;
}
}
} catch (error) {
console.log(error);
}
return null;
},
}),
],
import CredentialsProvider from "next-auth/providers/credentials";
import bcrypt from "bcrypt";
import prisma from "@/prisma/client";

export const authOptions = {
providers: [
CredentialsProvider({
name: "Credentials",
credentials: {
email: {
label: "email:",
type: "text",
placeholder: "your-email",
},
password: {
label: "password:",
type: "password",
placeholder: "your-password",
},
},
async authorize(credentials) {
try {
const foundUser = await prisma.user.findUnique({
where: { email: credentials!.email },
});

if (foundUser) {
console.log("User Exists");
console.log(foundUser);
const match = await bcrypt.compare(
credentials!.password,
foundUser.password
);

if (match) {
console.log("Good Pass");
foundUser.password = " ";

// foundUser["role"] = "Unverified Email";
return foundUser;
}
}
} catch (error) {
console.log(error);
}
return null;
},
}),
],
makes life a lot easier
9 replies
TTCTheo's Typesafe Cult
Created by Sammy on 2/6/2024 in #questions
Default JSON Value
This is a known issue with Vitess, try using the following as a work around: ("json_array()")
3 replies
TTCTheo's Typesafe Cult
Created by Teodorant Master Of Nonsense on 2/6/2024 in #questions
How do I setup credentials based auth with the app I created with T3 CLI?
Bro my eyes are hurting trying to look at the ss. post code
9 replies
TTCTheo's Typesafe Cult
Created by finalM on 2/7/2024 in #questions
Accessing a component's state from a different page (app router)
I mean this in the nicest way possible but if you're an absolute beginner you should really read the docs, and some other resources on RSC and SSR before jumping and asking questions on a discord, and I say that as someone whose asked a lot of stupid questions on discord
7 replies
TTCTheo's Typesafe Cult
Created by finalM on 2/7/2024 in #questions
Accessing a component's state from a different page (app router)
Ok, so pages reference different URL routes, so if you're moving outside of page you can't just pass props like you would with reactRouter. If you want to use context at the root level, you will have to wrap your context provider in a client component then wrap the children inside the layout of that client wrapper. Try to think, is this a component that runs exclusively on the server or both? if the server you don't have any access to client side react state management, and you're limited as to what you can pass client components, ie cant pass a callback to a client function from a server function.
7 replies
TTCTheo's Typesafe Cult
Created by beebae on 2/3/2024 in #questions
js to django
Ok I gotta ask... like y tho?
8 replies
TTCTheo's Typesafe Cult
Created by beebae on 2/3/2024 in #questions
js to django
of django? I'd start on their website, they have good docs
8 replies
TTCTheo's Typesafe Cult
Created by beebae on 2/3/2024 in #questions
js to django
Why are you switching to Django when you’re still trying to “figure out the purpose” of Django. Purpose of Django is that it allowed companies to move very fast with backends that didn’t need to be extremely performant and came from the rails era where opinionated frameworks, code scaffolding and HTML templates was the preferred route. Also Node and Django aren’t really equivalent, node is a runtime, Django is a framework, Django has a runtime of Python. IMO the only reason to use Django over modern frameworks or even springboot is if your backend has a lot of ML integrations that aren’t offloaded into api calls to OpenAi.
8 replies
TTCTheo's Typesafe Cult
Created by Kenzo on 1/22/2024 in #questions
Cheapest way to host images?
Why not just host the images directly on cloudflare and give your vercel instance a breather
43 replies
TTCTheo's Typesafe Cult
Created by Kenzo on 1/22/2024 in #questions
Cheapest way to host images?
If you’re hosting all the images directly on vercel then you shouldn’t need cloudflare to handle the CDN, I’m not 100% sure how you’d have this set up.
43 replies
TTCTheo's Typesafe Cult
Created by Kenzo on 1/22/2024 in #questions
Cheapest way to host images?
Also works with AWS cli I believe .
43 replies
TTCTheo's Typesafe Cult
Created by Kenzo on 1/22/2024 in #questions
Cheapest way to host images?
It has a very generous free tier that doesn’t expire over time. For a small scale project you should never have to pay a dime
43 replies
TTCTheo's Typesafe Cult
Created by Kenzo on 1/22/2024 in #questions
Cheapest way to host images?
And let’s be honest if you’re on this discord you care enough to consider the little things.
43 replies
TTCTheo's Typesafe Cult
Created by Kenzo on 1/22/2024 in #questions
Cheapest way to host images?
I mean yeah, but honestly you should consider upload thing or cloudflare, with a proper CDN integrated into the hosting you’ll get better performance
43 replies
TTCTheo's Typesafe Cult
Created by Kenzo on 1/22/2024 in #questions
Cheapest way to host images?
Btw if you find a service with a more generous free tier I’d be very interested.
43 replies
TTCTheo's Typesafe Cult
Created by Kenzo on 1/22/2024 in #questions
Cheapest way to host images?
I mean you could just host stuff of imgur and provide direct links. But Cloudflare buckets have 10million reads per month free. You could have 1k files with an average size of 1gb and still be inside the free tier
43 replies
TTCTheo's Typesafe Cult
Created by Kenzo on 1/22/2024 in #questions
Cheapest way to host images?
Cloudflare buckets have a very generous free tier and excellent performance, also if you’re in the T3 ecosystem I think Theo has a product you might be interested in.
43 replies
TTCTheo's Typesafe Cult
Created by Connor B on 1/7/2024 in #questions
Vercel + bun + private npm registries
Unfortunately bun, as far as I'm aware, can't read .npmrc files
3 replies
TTCTheo's Typesafe Cult
Created by Connor B on 1/1/2024 in #questions
Question re. next auth best practices in TRPc
Also, I have a Navbar which, when authenticated has the users avatar, if not authenticated has a sign in button. The Nav bar is placed just above the children in the root layout. Is there anyway to do a single call to getServerAuthSession and share it between the Navbar defined in the root layout and other server components in other pages?
2 replies