The OAuth resource owner password credentials flow explained.

OAuth Resource Owner Password Credentials Flow

On this page

What is the Resource Owner Password Credentials Flow in OAuth 2.0?

The Resource Owner Password Credentials flow (ROPC flow) is an OAuth 2.0 password grant flow designed for legacy systems where users provider their credentials directly to a client application. The user is authenticated by the client, passing the username and password in the request. This is an anti-pattern, and the flow only exists to provide an outlet for third-party applications that need to migrate to use OAuth-protected APIs but cannot be re-written.

The ROPC flow implies security risks such as credential exposure. It also lacks support for multi-factor authentication (MFA) and any other modern authentication method.

How ROPC Flow Works

Legacy flow

The ROPC flow only exists for historical reasons to support legacy applications. Do not use in new developments.

How the resource owner password credentials flow works in OAuth 2.0
  1. The client application collects the username and password from the user. It sends the credentials to the token endpoint of the authorization server.
  2. The authorization server validates the credentials and returns an access token (and, optionally, a refresh token) to the client.

User Authentication

The user is authenticated with a username and password. There is no other way to authenticate the user. This means that the flow cannot support multi-factor authentication or passwordless methods and thus does not meet common security requirements.

Client Authentication

The client authenticates as part of the token request. There are many ways for a client to authenticate. The most common being client secret. The Curity Identity Server supports the following authentication mechanisms for clients:

  • No authentication (public client)
  • Secret in POST body
  • Secret using Basic Authentication
  • Client Assertion JWT
  • Mutual TLS (mTLS) client certificate
  • Asymmetric Key
  • Symmetric Key
  • Credential Manager
  • JWKS URI

ROPC Authentication

An ROPC client can not be configured as a public client with no authentication.

The Access Token

The access token is returned by the token endpoint. It is the token that clients can use to call the API and gain access. It is often a bearer token, and as such, the client must not send it to untrusted parties. The access token usually has a lifetime of 5-30 minutes.

The Refresh Token

The refresh token is issued if the client is configured to have refresh tokens. This token can be used to obtain more access tokens once the first one expires. The refresh token may have a very long lifetime, ranging from hours to years.

ROPC Request Parameters & Token Handling

Request Parameters

  • Method: POST
  • Content-Type: application/x-www-form-urlencoded
  • Response Type: json
ParameterValueMandatoryDescription
client_idThe Client IDyesThe ID of the requesting client.
client_secretThe client secretyes*The secret of the client. *Mandatory if client authentication is of type secret, and the authentication is not done using basic authentication.
grant_typepasswordyesTells the token endpoint to perform the resource owner password credential flow.
scopeSpace-separated string of scopesnoList the scopes the client is requesting access to.
usernamethe usernameyesThe username of the resource owner.
passwordthe user passwordyesThe password of the resource owner.

Response

  • Response Type: application/json
ParameterValueMandatoryDescription
access_tokenA newly issued access tokenyesThe resulting access token for the flow.
refresh_tokenA newly issued refresh tokennoOnly issued if the client is configured to receive refresh tokens.
expires_inExpiration in secondsyesThe time to live of the access token in seconds.
scopeSpace-separated stringnoIf not present, the requested scopes were issued. If present, the issued scopes may differ from the requested scopes.
token_typeBearer or other token typeyesDescribes how the token can be used. Most commonly Bearer token usage.

Security Concerns & Best Practices

Since ROPC authentication requires the user to directly share their credentials and doesn't support multi-factor authentication, you should consider alternative OAuth flows such as:

Photo of Jacob Ideskog

Jacob Ideskog

Identity Specialist and CTO at Curity

Newsletter

Join our Newsletter

Get the latest on identity management, API Security and authentication straight to your inbox.

Newsletter

Start Free Trial

Try the Curity Identity Server for Free. Get up and running in 10 minutes.

Start Free Trial