Orchestration SDKs

Trying out RAR for JavaScript

PingOne Advanced Identity Cloud PingAM JavaScript

In this walkthrough you run a complete RAR payment transaction in a JavaScript web app: the app requests authorization for a specific payment, you approve the payment details on the Remote Consent Service page, and the app receives the granted details back in its tokens.

Before you begin

Ensure that you have completed the following prerequisite tasks before attempting to run the walkthrough:

The consent page that shows the user the payment details is a Remote Consent Service (RCS): a small web application that you host.

The authorization server sends it the requested authorization_details in a signed JWT, the RCS renders those details for you, and it returns a signed JWT with your decision.

In this step you’ll run a demonstration RCS and expose it over HTTPS, so you can try the complete flow without building your own consent UI.

Step 2. Prepare the authorization server

With the RCS running, your authorization server needs to know about it.

You’ll enable RAR processing on the OAuth2 provider, create a Remote Consent Agent pointing at your RCS, and configure an OAuth 2.0 client with the authorization detail types it may request.

The steps are the same on PingOne Advanced Identity Cloud and PingAM; only the console paths differ.

Step 3. Run the flow in your app

In this step you run the complete RAR payment transaction in your own JavaScript app.

  1. Add RAR support to your app, requesting the payment authorization details your client is configured to accept.

  2. Start the OAuth 2.0 flow with authorize.url() or authorize.background().

    The browser opens, you sign in, and the authorization server redirects to the RCS consent page.

  3. Review the payment details on the consent page, and approve them.

    The RCS returns its signed consent response, and the authorization server redirects back to your app with an authorization code.

  4. Exchange the code for tokens, and read the granted authorization_details from the token response.

    Check that the granted details match the payment you approved: type payment_initiation, the instructed amount, and the creditor.

Troubleshooting the result

What you see

What it means

Granted authorization_details is an empty array []

RAR processing ran, but the consent response carried no details. Either the RCS has no enricher for the requested type and dropped it, or the consent response did not echo the claim.

No authorization_details in the token response at all

RAR processing never ran. Check the Rich Authorization Requests with Remote Consent Service provider toggle, and the tenant version on PingOne Advanced Identity Cloud.

invalid_authorization_details at the authorize step

The requested type is not in the client’s Authorization Detail Type(s) list.

invalid_request at the authorize step

The client has implied consent enabled, which is incompatible with RAR. Turn implied consent off.

Consent page fails with a JWT signature error

The Remote Consent Agent’s signing algorithm does not match the RCS. With the demonstration RCS, set the agent to HS256.

"Unexpected number of Base64URL parts, must be three"

Consent request encryption is enabled on the agent. Turn it off; the demonstration RCS reads signed, not encrypted, JWTs.