What Exactly Is OAuth 2.0?

The term OAuth 2.0 (OAuth2 for short) is familiar to many IT decision-makers, technical leads, and business department staff involved in application and web development. End users also come into contact with this protocol more and more often, without noticing it. There is often disagreement about the exact definition of the underlying technology and how it is used. Here we first describe OAuth2 in a little more detail from a simple perspective. In further articles, we then go deeper into the technical details.

The term OAuth 2.0 stands for an established security standard and a protocol that enables secure access to various media such as devices, databases, and websites. Fundamentally, it is neither an API nor a specific service. The protocol is based on the HTTP standard used on the internet and can therefore be applied widely. Two independent versions currently exist, OAuth 1.0a and OAuth 2.0. The latter is not backward compatible.

What Is OAuth 2.0 Used For?

From the user’s perspective, OAuth 2.0 enables passwordless authentication and thus the secure use of applications and services. On many websites and for numerous applications, users can use their existing OAuth2-compatible user profile from Facebook, Twitter, or Google, for example. When logging in to a third-party website, the user only selects the corresponding option, for example “Log in with Facebook.” The user grants the third party the corresponding access rights and is then immediately redirected back to the third party’s site, where they log in with their Facebook ID. The provider uses the authentication and authorization standard OAuth 2.0 and can thus access the user’s resources in a controlled way without receiving the user’s credentials.

How Roles Are Distributed in Applications

For this simplified authorization to work across systems and networks, there must be a clear structure for passwordless access to user resources. An authorization server coordinates all operations and controls the authorization scenarios. When a user is registered with a provider such as Facebook or Google, that service plays the role of the identity provider. The user is the resource owner (the owner of the user data) and, after giving consent, can allow third parties (clients) passwordless access to selected resources such as user name, profile details, and other user data, without handing over the password.

Two servers work together here. The authorization server issues a valid token based on the client ID and the secret client key (client secret), and the resource server validates this token and then releases the data. This token must always be transmitted with all further logins, requests, and authentications between the parties. As an encrypted admission ticket, it represents a secure and valid passwordless authorization. The protocol flow is clearly defined. The client requests authorization from the resource owner and then receives an authorization grant. With this grant, the client requests a token from the authorization server in a second step. Only after the token has been issued can the client request the required data from the resource server.

What Tokens and Scopes Mean

When a client needs additional data about the logged-in user, for example for a purchase in its shop, it can request an access token from the authorization server. The scope parameter controls the access permissions in a targeted way. If the third party asks for customer data, for example, the authorization server limits the range of validity (scope) accordingly. As a result, the client receives a token with only these limited access rights.

When an access token expires, the client needs a new one. To get it, the client presents a previously issued refresh token to the authorization server and receives a fresh access token in exchange, without the user having to grant authorization again. Every token is also valid only for a limited time. Once this period ends, the token automatically becomes invalid, which increases the security of the protocol, because even an intercepted token is usable only briefly. Lifetimes of a few minutes up to about an hour are common.

Different Grant Types

The OAuth2 protocol includes several different authorization types (grant types), which regulate the amount of data required for transmission and thereby make communication more secure. The current grant types use the following security mechanisms.

  • With the authorization code (authorization_code), the user logs in at the provider and, on being redirected back, releases their data to the client. Together with a client ID and a password (secret), this constitutes the credentials.
  • The implicit grant (implicit) is similar to the authorization code and differs essentially only in its simpler communication process.
  • With the password grant (resource_owner_password), you would hand all your credentials directly to the client. This grant type is therefore not recommended because it can pose a high security risk.
  • With client credentials (client_credentials), the client can request additional information from the OAuth server that is not assigned to any owner.

Conclusion

The current OAuth2 security protocol makes delegated authorization of users considerably simpler. A Google account, for example, can be used with all OAuth2-compatible services and providers for quick and uncomplicated registration and for data exchange. Users also have extensive options for controlling and revoking third-party access rights. This enables transparent management of account data and logins. The key aspect of using OAuth2, however, is that users need only one account with a provider of their choice to sign in conveniently to all compatible client services.

We cover the technical details, including the protocol flow, token handling, and the individual grant types, in depth in the follow-up articles on this topic.

Share LinkedIn X Email