Authenticate using a client credentials flow
This API also supports the client credentials flow, which is designed for machine-to-machine (M2M) interactions, where an application needs to access resources without involving a user.
| You can only use this type of flow if your PingOne environment is connected to your PingOne Advanced Services environment and both are correctly configured. |
To set this up, you’ll need to:
To ensure that only administrators can generate access tokens, restrict access to the application that you created. Learn more about this process in Restricting access to the application.
Creating an OIDC application
Start by creating an OpenID Connect (OIDC) application in PingOne.
Steps
-
In the PingOne admin console, go to Applications > Resources.
-
Click Add.
-
Create the resource by completing these fields:
-
Resource name: A unique identifier for the resource.
-
Description (optional): A brief characterization of the resource that helps identify it.
-
-
Click Next.
-
On the Attributes page, click Add to add a new attribute.
-
Name the new attribute groups.
Enter the appropriate user access control roles.
Set the values to a hard-coded list of valid roles.
Learn more about these roles and permissions in User access control roles.
+ NOTE: The PingOne Advanced Services attributes must be set up for them to display in the list. Learn more about adding this attribute in Creating custom user attributes.
-
Click Next.
-
On the Scopes page, add a new scope to map the PingAccess role to the new application. Click Add Scope and complete the following fields:
-
Scope name: A unique identifier for the scope.
-
Description (optional): A brief characterization of the scope that helps identify it.
-
-
Click Save.
-
Add the OIDC application. Go to Applications > Applications.
-
Click the icon.
-
Complete the following fields:
-
Application name: A unique identifier for the application.
-
Description (optional): A brief characterization of the application that helps identify it.
-
Icon (optional): A graphic representation of the application. Use a file up to 1 MB in JPG, JPEG, GIF, or PNG format.
-
-
In the list of available application types, select OIDC Web App. Click Save.
-
On the Configuration tab, click the Pencil icon to edit the configuration.
-
Change the Response Type to none by clearing all the options.
-
Change the Grant Type to Client Credentials.
-
-
Click Save.
-
On the Resources tab, click the Pencil icon to add the scope you added in step 8 to the application.
-
Click Save and click the toggle at the top of the details panel to enable the application.
Generating a token
Access the new application in the PingOne admin console to generate an access token.
Steps
-
Follow the steps outlined in Getting an access token in the PingOne documentation.
-
Include the bearer token in the headers.
For example,
{"Authorization": "Bearer <TOKEN>"}.
Using the token to authenticate
Steps
If you’re using the API interactive documentation:
-
Go to the following URL:
https://self-service-api.<environment>-<customer>.<region>.ping.cloud/docs
-
Click Authorize.
-
Paste the token into the input field, click Authorize, and then click Close.
All requests made from the interactive documentation will be authenticated.
If you’re using command-line tools, such as Postman or cURL, query the API directly and include the bearer token in the headers.
For example, {"Authorization": "Bearer <TOKEN>"}
Restricting access to the application
To ensure that only administrators can generate access tokens, restrict access to the application that you created.
Steps
-
In the PingOne Advanced Services admin console, select the application, click the Access tab, and then click the Pencil icon.
-
Select the Admin Only Access checkbox and click Save.