1) OAuth2 allows web apps to access user data from authentication services like Google and Facebook by redirecting the user's browser to those services for authentication.
2) When a user grants permission, the authentication service provides an access token to the web app, which it can use to make API requests and access the user's data on the user's behalf.
3) To prevent access token theft, the authentication service provides an authorization code instead, which the web app exchanges for an access token on the backend without exposing it to the browser.