Authentication with JWT + graphql mutation
Answered
Highlander posted this in #help-forum
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".
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".
Answered by gin
u dont need graphql it is basically only needed for large scalable apps with microservices
20 Replies
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
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
HighlanderOP
jwt and graphql?
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
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
are you new to like react and next?
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
u dont need graphql it is basically only needed for large scalable apps with microservices
Answer
just look at any tutorial on youtube
for next
example: Building a dashboard or whatever
u will learn from there
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?