OAuth 2 is an authorization framework for granting limited access to protected resources. An authorization server issues access tokens, while a resource server verifies those tokens before allowing API requests. section 8.0 section 8.5
The trust model resembles a valet key: a client receives only the access needed to perform its job, rather than unrestricted control. OAuth 2 secures REST APIs and can also support third-party sign-in; OpenID Connect formalizes that authentication interaction. section 8.0 section 5.3.3
A typical OAuth 2 API interaction works as follows:
- The client obtains an access token from the authorization server, either for a user or through client token flow. section 8.5
- The client presents the token when requesting protected API resources. section 8.5
- The resource server checks that the token is valid, unexpired, and carries the required scope. section 8.5
Third-party sign-in with Facebook
A Spring application can let users sign in through Facebook instead of entering credentials locally. Configure the Facebook client ID and secret, request the email and public_profile scopes, enable oauth2Login(), and link users to /oauth2/authorization/facebook. Protected pages redirect unauthenticated users to Facebook; successful authentication returns them to the application. section 5.3.3








