/rest-api-authentication-tutorial

This repository is made to share source code of my blog post where I have explained how to do token based authentication for your Spring boot REST API using JSON web tokens(JWT).

Primary LanguageJava

banner.png

Spring Boot REST API authentication best practices using JWT

Token based API authentication with Spring Security and JWT (JSON web Token)

Overview

This repository is made to share source code of my blog post Spring Boot + JWT where I have explained how to do token based authentication for your Spring boot REST API using JSON web tokens(JWT).

Output

  • Handling unauthorized access to protected routes with error 401:

image.png

  • Get token in response of register request

image.png

  • Invalid credentials response when wrong username password is supplied:

image.png

  • Show content from protected route when Auth token is provided in header.

image.png