Common Usage of OAuth 2.0:
- OAuth 2.0 is a widely used authorization framework allowing websites to request limited access to a user's account on another application.
- It facilitates access without exposing login credentials, letting users control the data they share.
Three Main Parties:
- Client Application: Requests user data.
- Resource Owner: User whose data is requested.
- OAuth Service Provider: Controls user data and provides APIs for authorization and resource servers.
Elements in OAuth 2.0:
- Resource Owner: User granting access to protected resources
- User-Agent: The browser or mobile application through which the resource owner communicates with our authorization server.
- Resource Server: Server handling authenticated requests
- Client Application: The application that seeks access to resources.
- Authorization Server: Server issuing access tokens after authentication (e.g., twitter.com).
- Client_id & Client_secret: Identifiers for the application, with the secret known only to the app and authorization server.
- Response_type: Specifies the type of token requested (e.g., code).
- Scope: Defines the level of access requested.
- Redirect_uri: URL for user redirection after authorization.
- State: CSRF protection mechanism.
- Grant_type: Explains the grant type for token retrieval.
- Code & Access_token: A token which is issued as a result of successful authorization. An access token can be obtained for a set of permissions (scopes) and has a pre-determined lifetime after which it expires..
- Refresh_token: Allows obtaining a new access token without user prompt.
- Authorization Code Grant flow
- Authorization Code Grant with PKCE
-
Client Credentials Grant flow
OAuth Authentication:
- Although not originally intended for this purpose, OAuth has evolved into a means of authenticating users as well.
- The "Authorization Code" grant type is commonly used for authentication in websites when implementing features like "Sign in with Google" or similar social login functionalities.

.png)



