Spring Boot Oauth2 Client — Client Credentials Grant

Karanbir Singh
3 min readJul 18, 2020

If you are not a medium member yet, please use the link here to access it for free

Agenda

Spring 5.0, had introduced huge changes(major one was supporting reactive programming) and part of it was re-writing the Oauth2 Client to support the reactive paradigm.

And I would love to share knowledge around the same. In this article I will focus on the Oauth2 Client part only.

Prerequisites

  1. Knowledge of Spring Boot, Java.
  2. Good understanding of the Oauth2 Concepts.
  3. Some understanding of the reactive programming
  4. JDK 11 installed(tried using JDK 11 only). Though JDK 8 should also work.
  5. Authorization Server setup is out of context.
  6. Resource server is out of context but can be referred from previous article here

Some pros about the spring boot oauth2 client.

  • It will fetch the access token for you before fetching the actual resource
  • It will cache the access token until the expiry and will re fetch the new token after existing token has expired

Flow Diagram Video for better…

--

--

Karanbir Singh
Karanbir Singh

Written by Karanbir Singh

API developer + Web Application developer + Devops Engineer = Full Stack Developer