The OAuth 2.0 Grant Type password

The current OAuth 2.0 specification offers a simplified and fast way to request and transmit the customer data that is essential for an authorization process, such as username and password. With the OAuth2 grant “password,” a password credential for resource owners can be requested and issued. This procedure is generally used between the holder of the customer data, for example Google, and a third-party provider, for example the data storage service Dropbox, for a simplified customer registration.

If a customer wants to use the services of a service provider, an app, or a web service, they have to register or sign in on the website or in the app, either from scratch or through faster access with an existing social media account such as Google. If the customer uses the access through their existing Google account, these credentials are requested “directly” at the service provider in this procedure. The otherwise customary and secured redirect to the Google OAuth2 security server is omitted here. The provider can now request the user data and additional information directly from Google and log the customer in.

The Authorization Procedure for the Password Credential

Compared with the other grant types of OAuth 2.0, the password grant is needed only to issue the credentials with username and password. This credential therefore uses a simplified authorization procedure to clear a user for the release of services at a provider. The OAuth2 grant “password” also uses a simplified authorization workflow, which makes it especially suitable for a provider’s own mobile apps and web applications. The supposed advantage of a simple workflow, however, comes at the price of an increased security risk. The following two scenarios explain the essential difference.

  • If, for example, you sign in to Google with the user information stored there, this password credential can be used for Google services without risk. As long as you use only the provider’s own apps or web applications, the authorization key stays with Google.
  • If, on the other hand, you sign in to an outside service provider directly with your username and password through the grant type “password,” the provider can store the authorization key very easily and misuse it like a master key for other purposes.

The Authorization Flow in Detail

Compared with other OAuth 2.0 grant types, “password” uses different and greatly simplified procedures. For now, “only” the following two parties are involved in this kind of direct authorization.

  • A user who wants to sign in to a service provider, an app, or a web service and use its services.
  • A client (a service provider in the form of a website or web application) that wants to offer its visitors different services.

In this example, we initially see only a two-way communication between user and provider. The otherwise customary and secured authorization steps through an OAuth 2.0 provider are missing entirely here. This results in the following authorization sequence.

  • A user opens the website of a service provider and finds a sign-in or registration dialog there. Let us assume here that the user is not yet registered there. Through the obligatory input fields for username and password, the service provider could now ask directly for your credentials from Google, for example, to enable a sign-in.
  • If you now enter and confirm your credentials here, the service provider can immediately request the user data from Google directly and without further authorization by you. In addition, the service provider gains the ability to retrieve further user information about you and to use it again without asking.

Instead of a secured and additional request through an OAuth 2.0 provider, the service provider now has direct possession of your secret Google credentials. This data is also transmitted unencrypted, stored in the browser history, and can be reused at any time. Furthermore, with this data the service provider can gain equally direct access to other platforms that you use with this login information.

Caution and Security Come First

As a user, you are quickly tempted to sign in to new service providers, apps, and web offerings by the “direct” route with your existing registration data from Facebook or Google, for example. Before taking this step, however, you should always check whether it is a login with input fields generated by the provider itself or whether you are first redirected, through a button for example, to “your” provider (such as Google or Facebook) for a secured login. In any case, you should weigh carefully whether and to whom you pass on your existing login data from Google or Facebook. Sometimes a completely new registration with made-up user data kept specifically for this purpose can also be an advantage.

Share LinkedIn X Email