UserId from jwt token or form data?
Answered
Iridescent shark posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
Iridescent sharkOP
I have endpoint to create new tag item, and each item has userId that creates it. My question is should I send userId in body on client or can I use userId from jwt token that I send along with request? Which way is more common?
Answered by B33fb0n3
I would do it with the jwt token. Like this you are way more flexible: you can verify it, trust the payload, get data, ...
3 Replies
![Avatar](https://cdn.discordapp.com/avatars/301376057326567425/788b75eb8862277af3d31d317ada783f.webp?size=256)
B33fb0n3
I would do it with the jwt token. Like this you are way more flexible: you can verify it, trust the payload, get data, ...
Answer
![Avatar](https://cdn.discordapp.com/avatars/301376057326567425/788b75eb8862277af3d31d317ada783f.webp?size=256)
B33fb0n3
@Iridescent shark
if (solved) {
await markAsSolution();
} else {
throw new Error("What's missing to solve your question?")?
}