How it works...

Through this recipe we will be able to access the user's resources, which must be available at http://localhost:8080/api/profile if the application is running correctly. Supposing you have followed all the steps in this recipe and the application is running, after retrieving an access token, you would be able to send a request to the profile endpoint to obtain the following JavaScript Object Notation (JSON) result:

{ "name": "adolfo", "email": "adolfo@mailinator.com"}

But to access this endpoint, you have to present a valid access token retrieved after the user's approval to share her profile. The access token in this case will be validated because of the Resource Server configuration. By adding the @EnableResourceServer

Get OAuth 2.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.