OAuth is an open standard that allows users to provide websites or applications with delegated access to their information that is stored on other websites or applications without giving the credentials (i.e. password) that directly access the account where the information is stored. Instead, a delegated access token is provided which specifies access permissions. For example, companies like Amazon, Google, Facebook, Microsoft and Twitter enable users to share information in their accounts with third party applications or websites using mechanisms provided by OAuth.
OAuth 2 protocol includes the following entities:
- Client Application: a web or mobile application that requires access to user data on another website or application.
- Resource Owner (RO): a user that owns data and authorizes a Client Application to access the data.
- Resource Server (RS): a website or application that stores the data owned by the Resource Owner.
- Authorization Server (AS): a security token service that is linked to the Resource Server, which issues access tokens to data stored on the Resource Server.
Designed specifically to work with Hypertext Transfer Protocol (HTTP), OAuth essentially allows access tokens to be issued to third-party Client Applications by an Authorization Server with the approval of the Resource Owner. The third party then uses the access token to access the data which is hosted by the Resource Server.
The OAuth authorization process begins with an end user (Resource Owner) specifying that she wants to provide a Client Application with access to data on a third-party application (Resource Server). The Client Application redirects this request to an Authorization Server linked to the Resource Server, which authenticates the requesting end user (Resource Owner). The Authorization Server then authorizes the Client Application to access the user’s data on the Resource Server and redirects the user back to the Client Application with a single-use access code.
The single-use access code is sent back to the Authorization Server, where it is converted into an access token that the Client Application may use to access the Resource Server. At the same time, the Authorization Server may also send back a refresh token which will allow the Client Application to request a new access token when the current one expires.
OAuth is a service that is complementary to and distinct from OpenID Connect (ODIC). ODIC and OAuth are often used together, with OIDC providing the user authentication layer and OAuth as the authorization/delegated access layer.
OAuth is an authorization protocol, and not an authentication protocol, though it is sometimes used on its own as an authentication method – sometimes referred to as pseudo-authentication. The user (Resource Owner) is typically authenticated in the process of granting the OAuth access token, meaning that OAuth is sometimes viewed as an authentication method. However, OAuth was not designed with this use case in mind and making this assumption can lead to major security flaws.
The OAuth 1.0 protocol was published as RFC 5849 in April 2010. The OAuth 2.0 framework was published as RFCs 6749 and 6750 in October 2012.
OAuth 2.0 is not backwards compatible with OAuth 1.0. OAuth 2.0 provides specific authorization flows for web applications, desktop applications, mobile phones, and smart devices.
Because OAuth 2.0 is more of a framework than a defined protocol, one OAuth 2.0 implementation is not necessarily inter-operable with another OAuth 2.0 implementation.