Migrate Your Resource Owner Password Flow

Support for resource owner password was added to /oauth/token. Usage of the /oauth/ro endpoint was deprecated on 08 July 2017. The /oauth/ro endpoint was previously used to exchange a one-time password (OTP) received by the end-user email or SMS for an ID token and an access token. Auth0 has implemented a new API that replaces /oauth/ro for this use case and we recommend that you migrate to using the new endpoint.

Features affected

This change affects you if you use the Resource Owner Password Flow(sometimes called Resource Owner Password Grant or ROPG) and call /oauth/ro directly without the use of any Auth0 libraries or SDKs. Auth0 libraries such as Lock or Auth0.js have been updated to stop using /oauth/ro internally. If you use the lock-passwordless library, you can now use Passwordless Mode in Lock instead.

Actions

Change requests

Previously, the payload of a request to /oauth/ro looked similar to this:

{
      "grant_type": "password",
      "client_id": "123",
      "username": "alice",
      "password": "A3ddj3w", 
      "connection": "my-database-connection",
      "scope": "openid email favorite_color offline_access",
      "device": "my-device-name"
    }

Was this helpful?

/

The new implementation contains the following changes:

  • The endpoint to execute token exchanges is now /oauth/token.

  • Auth0's own grant type is used to authenticate users from a specific connection (or realm).

  • Auth0 supports the standard OIDC scopes, along with the scopes which you have defined in your custom API.

  • A scope that doesn't fit in one of these categories, such as the above favorite_color, is no longer a valid scope.

  • The device parameter is removed.

  • The audience parameter is optional.

Here is an example of the payload of a request to /oauth/token:

{
      "grant_type": "http://auth0.com/oauth/grant-type/password-realm",
      "client_id": "123",
      "username": "alice",
      "password": "A3ddj3w",
      "realm": "my-database-connection",
      "scope": "openid email offline_access",
      "audience": "https://api.example.com"
    }

Was this helpful?

/

  • The grant type is specified here as password-realm, rather than the standard password.

  • The parameters client_id, username, and password are unchanged.

  • The realm is included because we are using Password Realm grant type, and replaces the connection parameter from previous calls.

  • The scope parameter is mostly the same, but does not accept non-OIDC values.

  • The audience parameter can be added, indicating the API audience the token will be intended for.

Response changes

Responses from /oauth/ro were similar in format to the following:

{
      "access_token": "SlAV32hkKG",
      "token_type": "Bearer",
      "refresh_token": "8xLOxBtZp8",
      "expires_in": 3600,
      "id_token": "eyJ..."
    }

Was this helpful?

/

  • The returned access token is valid for calling the /userinfo endpoint (provided that the API specified by the audience param uses RS256 as signing algorithm) and optionally the custom API if one was specified.

  • The ID token will be forcibly signed using RS256 if requested by a public client.

  • A Refresh Token will be returned only if the offline_access scope was granted and the API has Allow offline access set.

Here is an example of the OIDC conformant response from /oauth/token:

{
      "access_token": "eyJ...",
      "token_type": "Bearer",
      "refresh_token": "8xLOxBtZp8",
      "expires_in": 3600,
      "id_token": "eyJ..."
    }

Was this helpful?

/

Verify migration

  1. Once you have migrated your codebase and are sure that your apps are not calling the endpoint, go to the Dashboard > Tenant Settings > Advanced.

  2. Scroll down to Migrations and toggle off Legacy /oauth/ro Endpoint. Turning off this switch disables the deprecated endpoint for your tenant, preventing it from being used.

Dashboard - Tenant Settings - Advanced - /oauth/ro Endpoint Migration Toggle Screen

If turning this switch off results in failed logins, this is a sign that you have yet to completely remove all instances of legacy code from your applications.

Once migrations have been successfully performed in production environments, the switch can be toggled off and left off, to ensure that the deprecated features can no longer be used.