---
title: Customize dynamic client registration
description: You can configure Advanced Identity Cloud to run a script after it has processed a dynamic client registration request. This scripted extension point lets you perform custom actions to modify the client profile, for example, by updating client attributes or manipulating user profile data to create client relationships.
component: pingoneaic
page_id: pingoneaic:am-oidc1:dynamic-client-registration-script
canonical_url: https://docs.pingidentity.com/pingoneaic/am-oidc1/dynamic-client-registration-script.html
keywords: ["OpenID Connect (OIDC)", "Setup &amp; Configuration", "Scripts"]
section_ids:
  dcr-create-script: Create a script
  dcr-configure-provider: Configure OAuth 2.0 provider to use the script
  dcr-test: Test your changes
---

# Customize dynamic client registration

You can configure Advanced Identity Cloud to run a script after it has processed a dynamic client registration request. This scripted extension point lets you perform custom actions to modify the client profile, for example, by updating client attributes or manipulating user profile data to create client relationships.

Advanced Identity Cloud calls the script after the following dynamic client registration operations:

* [Create](oauth2-dynamic-client-registration.html#dynamic-registration-options)

* [Update](oauth2-dynamic-client-registration.html#dynamic-management-update)

* [Delete](oauth2-dynamic-client-registration.html#dynamic-management-delete)

## Create a script

Advanced Identity Cloud includes [a sample script](../am-scripting/sample-scripts.html#oauth2-dynamic-client-registration-js) that updates client attributes with values from the request.

You can use this as a template to create your own custom script.

1. Create a script with the Script Type set to `OAuth2 Dynamic Client Registration`.

2. Write your own or copy the sample script into the Script field.

   A dynamic client registration script is a [next-generation](../am-scripting/next-generation-scripts.html) script. You have access to all [common](../am-scripting/script-bindings.html) next-generation bindings such as `openidm`, `httpClient`, and `utils`, to help you modify the client profile.

   |   |                                                                                                                        |
   | - | ---------------------------------------------------------------------------------------------------------------------- |
   |   | Learn about the bindings you can use in the [Dynamic client registration scripting API](../am-scripting/dcr-api.html). |

3. Save your changes.

## Configure OAuth 2.0 provider to use the script

After creating your script, you must configure Advanced Identity Cloud to use it.

1. Under Native Consoles > Access Management, go to Realms > *Realm Name* > Services > OAuth2 Provider > Client Dynamic Registration to configure a specific OAuth 2.0 provider.

2. Set Dynamic Client Registration Script to the name of the script you want to use.

3. Save your changes.

## Test your changes

1. Perform a request to dynamically register, update, or delete a client profile.

2. The provider runs the script after the operation completes successfully.

   *The script isn't invoked if the operation fails.*

3. Verify that the script makes the changes as expected.

   For the sample script, check for the following modifications depending on the type of request:

   * `CREATE` operation

     The script makes the following changes:

     * Sets the client attribute `com.forgerock.openam.oauth2provider.grantTypes` to `authorization_code` and the grant type for the request

     * Sets the client type to `Public`

     * Sets the client scopes to `read` and `write`

   * `UPDATE` operation

     The script adds the software statement's `redirect_uris` property to the client attribute `com.forgerock.openam.oauth2provider.redirectionURIs`.

   * `DELETE operation`

     The script makes no changes.

   |   |                                                                                                                                                                                                                                                                        |
   | - | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   |   | You can find the property names used to update client attributes, such as `com.forgerock.openam.oauth2provider.grantTypes` by querying the [/realm-config/agents/OAuth2Client](../am-oauth2/rest-api-oauth2-client-admin-endpoint.html#query-oauth2-clients) endpoint. |
