About IdP Writeback in the C3 Agentic AI Platform
With IdP writeback, C3 AI user management APIs directly update the IdP when you call the APIs in a C3 AI application console. IdP writeback ensures your IdP and C3 AI user management systems remain in sync.
This topic explains how to enable IdP writeback, describes the user management APIs you can use that write back to the IdP, and the IdP writeback flow in the C3 Agentic AI Platform.
Prerequisite
To perform IdP management tasks that write back to the IdP in the C3 Agentic AI Platform, a user must have at least one of the following roles:
C3.ClusterAdminC3.StudioAdminC3.UserAdmin
Allow non-admin users to perform IdP management tasks
C3OktaWriteBack is an Okta IdP role that lets users perform IdP management tasks in the C3 Agentic AI Platform without requiring further admin-level privileges.
Assign this role to users in the Okta IdP to allow them the following capabilities:
User management
- Create users
- View and edit user details
- Edit user group memberships
- Edit user Okta applications
Group management
- View groups and their details
- Manage group membership
Application management
- View Okta application details
- Edit Okta application users or group assignments
Enable IdP writeback
Complete the following steps to enable IdP writeback:
- Create an Okta application
- Configure the OktaRestApi Type
- Create an OpenID Connect (OIDC) application
- Configure the OIDC application
1. Create an Okta application
Follow the steps in the Okta documentation at Implement OAuth for Okta with a service app. Apply the following settings:
- In the Okta Admin Console, set App Integration sign-in method to API Services
- In the Applications > General settings, configure the following:
- Application type: Service
- Grant type: Client credentials
- Proof of possession: Uncheck Require demonstrating proof of posession (DPoP) header in token requests
- Client authentication: Public key / Private key
- Public key configuration: Save keys in Okta
- Generate a public/private JSON Web Key Set (JWKS) and save the private key.
- Grant the following Okta API Scopes:
okta.apps.manageokta.apps.readokta.groups.manageokta.groups.readokta.users.manageokta.users.read
2. Configure the OktaRestApi Type
In the C3 AI Console, run the following code to configure the OktaRestApi Type.
Pass the client ID, Okta application URL, private key, and token endpoint. To learn how to provide a key pair using the CryptoPrivateKey Type, see Generate a Cryptographic Key.
// Set the Okta instance details
clientId = "<oktaClientID>";
oktaUrl = '<....>/api/v1';
strFormat = {<PrivateKey>}
tokenOauthEndpoint = "<oktaIntanceID>/ouath2/v1/token";
override = <override>;
var ck = CryptoPrivateKey.fromJwk(strFormat);
// Set the OktaRestApi Type
OktaRestApi.setOAuth(
oktaUrl,
RestConfig.OAuth.make({
clientCredentials: OAuthApplicationCredentials.make({clientId: clientId}),
tokenEndpoint: tokenOauthEndpoint
}),
ck,
override
);3. Create an OpenID Connect (OIDC) application
Follow the steps in the Okta Help Center at Create an OIDC Web App in the Okta Admin Console. Apply the following settings:
- In the Okta Admin Console, set Sign-in method to OIDC - OpenID Connect.
- In the Applications > General settings, configure the following:
- Client authentication: Client secret
- Proof Key for Code Exchange (PKCE): Unchecked
- Grant type: Client credentials, check Authorization code and Refresh Token
- In the LOGIN section, add the sign-in redirect URI that contains your C3 AI application URL:
https://<applicationUrl>/oidc/login.
4. Configure the OIDC application
In the C3 AI console, configure the OIDC application to enable IdP writeback. Complete Step 5: Configure OIDC in C3 AI application in Integrate OpenID Connect and Okta.
Pass the OIDC Okta application client ID, redirect URI, and Okta application URL.
Then, run the following code to set the configuration:
OidcIdpConfig.forId("<ApplicationURL>").setConfigValue("externalAppId", "<OktaApplicationID>", <ConfigOverride>)
AppUrl.forId("<ApplicationURL>").withIdpConfig(OidcIdpConfig.forId("<ApplicationURL>")).setConfig("CLUSTER")Next, set the user ID format:
OidcIdpConfig.forId("<ApplicationURL>").setConfigValue("userIdFormat", "LOWERCASE_EMAIL", <ConfigOverride>)This code sets the user ID format requirement to be lowercase email.
User management APIs that perform IdP writeback
IdP writeback allows the following C3 AI user management APIs to directly write to the IdP.
Okta.createUser
The Okta.createUser API creates a new user in the Okta identity management system. Here is an example of how to call this method:
var user = Okta.createUser({
username: 'jane.doe@example.com',
email: 'jane.doe@example.com',
firstName: 'Jane',
lastName: 'Doe',
password: 'YourPassword123'
});Okta.addUserToApp
The Okta.addUserToApp adds the user to the Okta application. Here is an example of how to call this method:
Okta.addUserToApp(`jane.doe@example.com`, `<OktaApplicationID>`)The <OktaApplicationID> applies to the OidcIdpConfig configuration as the externalAppId.
User.addToGroup
The User.addToGroup API adds a user to a specific group within the C3 Agentic AI Platform. Here is an example of how to call this method:
var user = User.forId('jane.doe@example.com');
var group = UserGroup.forId('group-id');
user.addToGroup(group);User management flow with IdP writeback
With IdP writeback, user management APIs directly write to the IdP and do not require C3 AI Operations to handle any steps, unless a you create a user without an IdP account. The following diagram describes the IdP writeback flow in the C3 Agentic AI Platform:
- A user with the
UserAdminrole creates a user in the C3 AI application with theOkta.createUserAPI, and adds the user to the Okta application with theOkta.addUserToAppAPI. - The
Okta.createUserandOkta.addUserToAppAPI writes back to the IdP and the IdP creates a corresponding user in the IdP. - The
UserAdminassigns the user to a C3 AI group with theUser.addToGroupAPI. - The
UserAdminadds the user to a C3 AI group with theUser.addToGroupAPI. - The user sends a request to the IdP to access the C3 AI application.
- The IdP returns a JSON Web Token (JWT) for the authenticated user. The IdP performs authentication only, not authorization.
To map the C3 AI application user group to the corresponding IdP group, see Step 6: Set UserGroup mapping in Integrate OpenID Connect and Okta.