Next.js Discord

Discord Forum

Authentication with JWT + graphql mutation

Answered
Highlander posted this in #help-forum
Open in Discord
Avatar
HighlanderOP
I have a test task, I have a ready authentication page from shadcn ui. The requirement is to use it in nextjs with jwt+graphql. I don't have much backend knowledge, can someone please explain what and how I am supposed to make the login page work?

The front is ready with nextjs and shadcn ui. I just don't know how to make the backend work. When I log in, it would show a new page with saying "hooray I logged in".
Image
Answered by gin
u dont need graphql it is basically only needed for large scalable apps with microservices
View full answer

20 Replies

Avatar
send email and pass with server action, set encrypted jwt cookie with your actual session token, revalidate cache, return success and redirect to your hooray page
Avatar
HighlanderOP
thank you. where should I look into for that? for the purely coding part. which docs am I supposed to read? or video
these are the two u need from next
rest is basic react
Avatar
HighlanderOP
jwt and graphql?
Avatar
for what graphql?
do u have a existing graphql backend or what
if u do, u can just fetch your endpoint on the server via server action
Avatar
HighlanderOP
nope, i need to write it, it is said for mutations (login and refreshtoken) and using few JWT tokens from api
i just don't know where to start for that
Avatar
are you new to like react and next?
Avatar
HighlanderOP
no not to react. i am just not familiar with graphql and jwt part, full backend for authorization part. it is like a wall that does not let me pass to the backend
Avatar
u dont need graphql it is basically only needed for large scalable apps with microservices
Answer
Avatar
just look at any tutorial on youtube
for next
example: Building a dashboard or whatever
u will learn from there
Avatar
HighlanderOP
sure. just the test task requirement says use graphql request to get data (name and avatar) from api. it should not be much of a work right?