Sync Ping OAuth2 tokens via Rest API

API toolWorkatoDeveloper ToolAPI IntegrationRecipe Tools

What it does

When someone sends a POST request to the oauth2.token endpoint, this automation forwards it to Ping Identity. The automation returns the token response, or logs and returns a 500 status if Ping fails.

Who it's for

Security teams who manage OAuth2 token exchange and need to proxy Ping Identity requests through a central API.

How teams use this

Exchange authorization codes for tokens

A consumer application sends a POST with grant_type and code to get back access_token and id_token from Ping Identity without calling Ping directly.

Centralize OAuth2 error handling

Route all Ping Identity token errors through this endpoint so failures are logged and parsed consistently before returning to the caller.

Add request validation before Ping

Include a step to check that required parameters are present and valid before forwarding to Ping, only proceeding if all fields pass validation.

Log tokens for audit trails

Add a step to hash and store id_token values in a log for debugging and compliance audits, with each token hashed using HMAC-SHA256 and a secret key.

How it works

  1. Receive POST request to oauth2.token. Listen for incoming POST requests to the oauth2.token endpoint with grant_type, code, redirect_uri, and code_verifier parameters from the consumer application.
  2. Forward POST to Ping OAuth2 endpoint. Send the consumer parameters as form-urlencoded data to Ping Identity via Rest. Ping returns access_token, id_token, and other OAuth2 response fields.
  3. Check Ping response status code. If Ping returned status 200, proceed to call the internal crittoken endpoint with the JWT authorization header. If not 200, route to error handling.
  4. Call crittoken endpoint with JWT. Send a POST to the internal crittoken endpoint with the static JWT authorization header from the project property. Return the crittoken response to the consumer as-is.
  5. Return error or success to caller. On success, return the token response with status 200. On Ping or crittoken failure, parse the error and return status 500 to the consumer.