PingOne Advanced Identity Cloud

Return callback information

The /json/authenticate endpoint supports callback mechanisms to perform complex authentication journeys. When Advanced Identity Cloud needs to return or request information, it returns a JSON object with the authentication step, the authentication identifier (authId), and the related callbacks.

Advanced Identity Cloud supports the following callback types:

Read-only callbacks

Read-only callbacks provide information to the user, such as text messages or the period of time a user must wait before continuing their authentication journey.

Interactive callbacks

Interactive callbacks request information from the user. For example, their username and password, or a request that they select between different configured options.

Backchannel callbacks

Backchannel callbacks let Advanced Identity Cloud access additional information from the user’s request. For example, a specific header or certificate.

Read-only and interactive callbacks have an array of output elements that can be displayed to the end user. The JSON returned in an interactive callback includes an array of input elements that must be completed and returned to Advanced Identity Cloud. For example:

"output": [
    {
        "name": "prompt",
        "value": " User Name: "
    }
    ],
"input": [
    {
        "name": "IDToken1",
        "value": ""
    }
]

The value of some interactive callbacks can be returned as headers, such as the X-OpenAM-Username and X-OpenAM-Password headers, but most of them must be returned in JSON as a response to the request.

Depending on how complex the authentication journey is, Advanced Identity Cloud could return several callbacks sequentially. Each must be completed and returned to Advanced Identity Cloud until authentication is successful.

Continue an authentication journey

Each response from the /json/authenticate endpoint includes an authId value. The authId identifies the current state of the authentication journey to Advanced Identity Cloud, and Advanced Identity Cloud can change it as the journey progresses. Use the value exactly as Advanced Identity Cloud returns it. Don’t decode it, modify it, or construct one yourself. Advanced Identity Cloud rejects authId values it can’t verify.

The authId carries the journey session. With client-side journey sessions, it holds the session state itself. With server-side journey sessions, it references the session Advanced Identity Cloud maintains in the CTS token store. Learn more in Client-side sessions and Server-side sessions.

Your client application is responsible for storing the authId and callback data from each response. Advanced Identity Cloud can’t continue the journey unless your client sends the authId. Applications that use the Ping Orchestration SDKs don’t handle this step themselves. The SDK manages the authId and callback exchange.

To continue a journey, send another POST request to the /json/authenticate endpoint. Include the authId and the callbacks from the latest response in the JSON request body, with the requested input values completed. Advanced Identity Cloud uses the authId to retrieve the journey’s current state, then processes the completed callbacks to move to the next step of the journey.

After each response, replace the authId and callback data you stored from the previous response with the new values before making the next request. Don’t reuse an earlier authId to continue a later step of the same journey.

When Advanced Identity Cloud returns a successful response containing tokenId instead of callbacks, the journey is complete and no further callback requests are required. The user can then log out of Advanced Identity Cloud.

Example callback

The following example shows a request for authentication, and Advanced Identity Cloud’s response of the NameCallback and PasswordCallback callbacks:

$ curl \
--request POST \
--header "Content-Type: application/json" \
--header "Accept-API-Version: resource=2.0, protocol=1.0" \
'https://<tenant-env-fqdn>/am/json/realms/root/realms/alpha/authenticate'
{
  "authId": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvdGsiOiJ...", (1)
  "callbacks": [
    {
      "type": "NameCallback", (2)
      "output": [ (3)
        {
          "name": "prompt",
          "value": " User Name: "
        }
      ],
      "input": [ (4)
        {
          "name": "IDToken1",
          "value": ""
        }
      ]
    },
    {
      "type": "PasswordCallback",
      "output": [
        {
          "name": "prompt",
          "value": " Password: "
        }
      ],
      "input": [
        {
          "name": "IDToken2",
          "value": ""
        }
      ]
    }
  ]
}
1 The authId JWT, which uniquely identifies the authentication context to Advanced Identity Cloud.
2 The type of callback. It must be listed under Return callback information.
3 The information Advanced Identity Cloud offers about this callback. Usually, this is displayed to the user in the UI.
4 The information Advanced Identity Cloud is requesting. The user must complete the "value": "" field with the required information.

To respond to a callback, send back the whole JSON object with the missing values supplied. The following example shows how to respond to NameCallback and PasswordCallback, with the username and password values supplied:

$ curl \
--request POST \
--header "Content-Type: application/json" \
--header "Accept-API-Version: resource=2.0, protocol=1.0" \
--data '{
  "authId":""eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvdGsiOiJ...",
  "callbacks": [
    {
      "type": "NameCallback",
      "output": [
        {
          "name": "prompt",
          "value": "User Name"
        }
      ],
      "input": [
        {
          "name": "IDToken1",
          "value": "bjensen"
        }
      ],
      "id": 0
    },
    {
      "type": "PasswordCallback",
      "output": [
        {
          "name": "prompt",
          "value": "Password"
        }
      ],
      "input": [
        {
          "name": "IDToken2",
          "value": "Secret12!"
        }
      ],
      "_id": 1
    }
  ],
}' \
'https://<tenant-env-fqdn>_/am/json/realms/root/realms/alpha/authenticate'
{
  "tokenId": "lWY23F4fuC7cu4Fq4GQa5u6drlQ...*",
  "successUrl": "/enduser/?realm=/alpha",
  "realm": "/alpha"
}