© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
26 replies
Bordin

Securing API with jwt

Hey, I am building the apis for the user. After user logs in he receive a JWT token which gives him access to the rest of the APIs.
He now have access to updating his profile picture API which requests two things
1- picture (PNG, gif, jpeg)
2- his Id

After filling these the APIchecks if the id matches the IDhe has in his JWT with claims. If they don't the api will return "Unauthorized".

However a user can easily mess around with JWT and change the claims values. He can change the role from User to Admin, he can change his Id in the claims too!

I can stop asking the user for the id and just get it directly from the jwt token, but it is still not secure enough.

thank you for your help
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ JWT + Microsoft.AspNetCore.Authentication.JwtBearer
C#CC# / help
3y ago
API protection with JWT + Duende server
C#CC# / help
3y ago
✅ JWT Authorization Issue with .NET Core Web API
C#CC# / help
3y ago
❔ JWT with Identity issue
C#CC# / help
4y ago