This recipe is useful when you don't have Spring Security OAuth2 in your project but are still using the Spring Framework. Instead of using OAuth2RestTemplate
, this recipe shows you how to use raw RestTemplate
implementation to interact with any OAuth 2.0 Provider.
To run this recipe, make sure you have an OAuth 2.0 Provider running on your machine. I recommend you use the project auth-code-server
presented in Chapter 2, Implementing Your Own OAuth 2.0 Provider. If you have any doubts about the source code presented in this recipe, do not hesitate to download the source code available on GitHub at https://github.com/PacktPublishing/OAuth-2.0-Cookbook/tree/master/Chapter03/client-rest-template. Besides having an OAuth 2.0 Provider running, you will need Java 8, Maven, and your preferred IDE (remember that most examples are presented using Eclipse).