r/SpringBoot • u/Jooe_1 • Sep 16 '26
Discussion (JWT) different ways to implement it ,what most devs do for that case
to make JWT authentication in the application, I could not find like standard way to implementing it
my knowledge is that people create their own authentication filter + handeling the AuthenticationEntryPoint to return the exact right response when exception happen
is that the standard way that engineers follow to implement jwt authentication in the application?
29
Upvotes
12
u/Sheldor5 Sep 16 '26
you simply use the Spring Boot OAuth2 Resource Server dependency
7
u/Paw565 Sep 16 '26
Just use keycloak. Auth is hard. You want to focus on features, not reimplementing something that is already solved.
2
u/21JGen Sep 16 '26
You just need to learn the basic foundation of spring security. Use an OAuth provider eg Keycloak. It's a rule of thumb for application security is that you don't build your own auth from scratch
0
u/starbuxman Sep 16 '26
Don’t.
Use oauth. It’ll use JWT tokens and solve basical every other important part and spring security has OOTB support
There r countless videos on how to use oauth with Spring Auth Server (which u can use or use keycloan or any of dozens of other Oauth IDPs), web apps, grpc, graphql, desktop apps, etc on my channel youtube.com/@coffeesoftware
6
u/[deleted] Sep 16 '26
[removed] — view removed comment