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:
-
Step 2. Preparing the authorization server
The walkthrough supports both PingOne Advanced Identity Cloud and PingAM.
Step 1. Host the Remote Consent Service
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.
-
Add RAR support to your app, requesting the payment authorization details your client is configured to accept.
-
Start the OAuth 2.0 flow with
authorize.url()orauthorize.background().The browser opens, you sign in, and the authorization server redirects to the RCS consent page.
-
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.
-
Exchange the code for tokens, and read the granted
authorization_detailsfrom the token response.Check that the granted details match the payment you approved: type
payment_initiation, the instructed amount, and the creditor.
What you see |
What it means |
Granted |
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 |
RAR processing never ran. Check the Rich Authorization Requests with Remote Consent Service provider toggle, and the tenant version on PingOne Advanced Identity Cloud. |
|
The requested type is not in the client’s Authorization Detail Type(s) list. |
|
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. |