advancedSpring Security

What is the difference between oauth2Login() and oauth2ResourceServer() in Spring Security?

oauth2Login() is for apps acting as an OAuth2 CLIENT — it drives the Authorization Code flow and creates a session. oauth2ResourceServer() is for APIs acting as a RESOURCE SERVER — it validates incoming JWT Bearer tokens per request, stateless, no session. Most microservices use oauth2ResourceServer().

This is a Pro question

Sign in, then upgrade to Pro or Power to unlock this question and the full Interview Prep bank.

What is the difference between oauth2Login() and oauth2ResourceServer() in Spring Security?

Next Step

Continue to How does Spring Security validate JWT tokens in an OAuth2 Resource Server?← Back to all Spring Boot & Microservices questions