Duckit69
Explore posts from serversKPCKevin Powell - Community
•Created by Duckit69 on 4/14/2025 in #help
JWT TOKEN
i might be wrong here but
async function login(req: Request, res: Response) {
try {
// get User
const user = await User.getUserByUserNameOrThrow(req.body.username);
// Validate password
const isMatch = await comparePassword(req.body.password, user.password);
if (!isMatch)
res.status(400).send({ status: "error", message: "Invalid credentials" });
// Generate access and refresh tokens
const accessToken = generateAccessToken(user.id.toString());
const refreshToken = generateRefreshToken(user.id.toString());
res.cookie("refreshToken", refreshToken, {
httpOnly: true,
secure: false,
sameSite: "lax",
maxAge: 30 * 24 * 60 * 60 * 1000, // 30 days
});
res.status(200).json({ accessToken: accessToken });
} catch (error) {
res.status(400).json(error);
}
}
the cookie is sent this way when i open my dev tools and send a request without cookie parser
the problem is:
1) everyone says you should store access token in memory but i didnt find any guide/tutorial so i hope someone can help me
2) i dont know how to send the refresh token with every follow up request9 replies
KPCKevin Powell - Community
•Created by Duckit69 on 4/14/2025 in #help
JWT TOKEN
u set that up from the backend the main issue ( forme is dealing withacess token )
9 replies
KPCKevin Powell - Community
•Created by Duckit69 on 4/14/2025 in #help
JWT TOKEN
cookie parser for what for the refresh token ?
9 replies
KPCKevin Powell - Community
•Created by Duckit69 on 4/10/2025 in #help
Form React
i get it that this is how it works my idea is
this adds compelxity unless you must control an input field there is no justified use for the useState for each input
3 replies
KPCKevin Powell - Community
•Created by Duckit69 on 4/4/2025 in #help
Hero Section
okay imma exhaust your suggestions
23 replies
KPCKevin Powell - Community
•Created by Duckit69 on 4/4/2025 in #help
Hero Section
i tried this approach and all the content is stuck at the top
23 replies
KPCKevin Powell - Community
•Created by Duckit69 on 4/4/2025 in #help
Hero Section
so whatever the space the children take the parent will expand to cover it
23 replies
KPCKevin Powell - Community
•Created by Duckit69 on 4/4/2025 in #help
Hero Section
and push the navbar and the content as its children
23 replies
KPCKevin Powell - Community
•Created by Duckit69 on 4/4/2025 in #help
Hero Section
i will try to
23 replies
KPCKevin Powell - Community
•Created by Duckit69 on 4/4/2025 in #help
Hero Section
i am sorry but i did not understand it
23 replies
KPCKevin Powell - Community
•Created by Duckit69 on 4/4/2025 in #help
Hero Section
flex parent ? u mean display flex on parent levle ?
23 replies
KPCKevin Powell - Community
•Created by Duckit69 on 4/4/2025 in #help
Hero Section
like the second div ( where the text exist ) has its own background ( i can be wrong i am just thinking out loud )
23 replies
KPCKevin Powell - Community
•Created by Duckit69 on 4/4/2025 in #help
Hero Section
<nav className="flex items-center justify-between absolute w-full top-4 px-4">
<a href="/">
<img src={logo} alt="logo" className="size-10" />
</a>
<ButtonAnchor
text="Join us!"
path="test"
className="text-black text-xl"
/>
</nav>
function App() {
const hederHeroClasses = [
"bg-[url(./assets/heroImg.jpg)]",
"bg-cover",
"mx-auto",
"w-full",
"py-12",
"h-48",
];
return (
<>
<div className="text-white bg-cyan-800">
<div className="opacity-10">
<div className={
${hederHeroClasses.join(" ")}}></div>
</div>
<Navbar></Navbar>
<div className="px-6 ml-10">
<p className="text-2xl">Book Tracker</p>
<p className="text-3xl">
Because life's too busy to track your own books.
</p>
</div>
</div>
</>
);
}
23 replies
KPCKevin Powell - Community
•Created by Duckit69 on 3/30/2025 in #back-end
Problem with Prisma
i have a prisma.schema file
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
and three other models that connect normally they get the url from prisma.schema ( i followed the docs ) but the User Model cant find the URL for some reason and keep throwing that error8 replies
KPCKevin Powell - Community
•Created by Duckit69 on 3/30/2025 in #back-end
Problem with Prisma
btw hardcoing it in this specific model seems to work
const prisma = new PrismaClient({
datasources: {
db: {
url: "prisma+postgres://accelerate.prisma-data.net/?api_key=SOMERANDOMLETTERsI",
},
},
});
what triggers me the most why only this specific model is throwing this error other models work fine8 replies