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) is a server to server flow. 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 applications that need to be migrated to use OAuth protected APIs, but cannot be re-written.
How ROPC Flow Works
Legacy flow
The ROPC flow only exist to support legacy applications. Do not use in new development.
Token Endpoint
- The Client makes a POST request to the Authorization Server
- The Authorization Server issues the tokens immediately and responds to the client
User Authentication
The user is authenticated in the token request. The Client passes the username and password to the token endpoint. There is no other way to authenticate the user, and multi-factor authentication is not supported by the flow.
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 must not be sent 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.
The Token Endpoint
Request Parameters
- Method:
POST
- Content-Type:
application/x-www-form-urlencoded
- Response Type:
json
Parameter | Value | Mandatory | Description |
---|---|---|---|
client_id | The Client ID | yes | The ID of the requesting client |
client_secret | The client secret | yes* | The secret of the client. *Mandatory if client authentication is of type secret, and the authentication is not done using basic authentication |
grant_type | password | yes | Tells the token endpoint to do perform the resource owner password credential flow. |
scope | Space separated string of scopes | no | List the scopes the client is requesting access to. |
username | the username | yes | The username of the resource owner |
password | the user password | yes | The password of the resource owner |
Response
- Response Type:
application/json
Parameter | Value | Mandatory | Description |
---|---|---|---|
access_token | A newly issued access token | yes | The resulting access token for the flow |
refresh_token | A newly issued refresh token | no | Only issued if the client is configured to receive refresh tokens |
expires_in | Expiration in seconds | yes | The time to live of the access token in seconds |
scope | Space separated string | no | If not present the requested scopes where issued. If present the issued scopes may differ from the requested scopes. |
token_type | Bearer or other token type | yes | Describes how the token can be used. Most commonly Bearer token usage. |
Jacob Ideskog
Identity Specialist and CTO at Curity
Join our Newsletter
Get the latest on identity management, API Security and authentication straight to your inbox.
Start Free Trial
Try the Curity Identity Server for Free. Get up and running in 10 minutes.
Start Free Trial