OAuth2 is an authorization protocol that lets a user grant a third-party application limited access to their data on another service, without ever sharing their password with that application.
Clicking "Sign in with Google" on a third-party site sends you to Google's login page; after you approve, Google gives the site a token that lets it read your profile but never exposes your Google password to that site.
A concise interview answer is
OAuth2 lets a user authorize an application to access their data without sharing credentials. The flow redirects the user to the provider's login, the provider issues an authorization code after consent, and the app exchanges that code for an access token it uses on future API calls.
Last updated: 11 November 2026
Previous question: What is SLF4J logging?
Next question: What details are present in a JWT token?