Hi team, I’m using the `configureMapping` method ...
# ask-a-descoper
l
Hi team, I’m using the
configureMapping
method via the Management SDK: let resp = await descopeClient.management.sso.configureMapping(tenantId, roleMapping, attributeMapping); From what I understand, this updates the SSO mapping configuration for a single tenant at a time. Is there a way to perform a bulk update - for example, updating SSO mappings for multiple role/attribute mappings in one call?
n
Hey Lasha 👋 Right now the configureMapping method only updates SSO mappings one tenant at a time. If you need to update multiple tenants, the approach would be to loop through your tenant IDs and call configureMapping for each. There isn’t currently a bulk/batch update method for role/attribute mappings across tenants, but you can script it with the Management SDK. If this is something you’d like to see supported, you can raise a feature request directly from your Descope portal for future enhancements. Helpful Articles: https://docs.descope.com/support/descope-fr-portal https://docs.descope.com/management/tenant-management/sso/sdks
l
Thank you @Nick Rodriguez. One more question: I'm trying to call
configureMapping
with the above values. But it won't create and i get the following:
Copy code
Status Code: 400
Error Code: E011001
Error Description: Request is malformed
Error Message: undefined
Using the same
tenantId
as in every other request, so that can't be a problem. Do you have any idea what might be causing this?
n
There are two common issues associated with this error: 1. The user tried to log in with SSO, but there is not a single tenant with the email domain associated with the user. 2. A tenant with the received name was not found. Check whether the tenant exists and whether the name was not misspelled. A few things to check: •
roleMapping
and
attributeMapping
should be arrays of objects, each with the right keys (e.g.,
value
/
attributeName
,
expectedValue
, and
roleNames
as an array). • Make sure all
roleNames
already exist in the project and are spelled exactly. • Pass empty arrays (
[]
) if you don’t need one of the mappings—avoid
null
or
{}
. • Strip out any hidden
undefined
keys from the objects. • Confirm the tenant has an SSO connection set up before updating mappings. If you log the JSON you’re sending before the call, you’ll usually see what’s tripping validation.
l
@Nick Rodriguez we're aiming to support the following flow and would love your input on whether this is feasible with the current Descope SSO APIs: We need to be able to create, update, and delete SSO mappings, and then submit the changes, but this is only for one tenant and not for multiple. Could you confirm if this kind of flow is possible with the existing APIs? If not directly supported, any guidance on how to structure the steps to achieve something similar would be greatly appreciated.
n
Yes, I don’t see this being an issue. We have all of the calls in place for create, update, and delete (in Descope terms Get, Set, Delete). All API calls are available here: https://docs.descope.com/api/management/tenants/sso If, later down the line, your use case becomes more complicated we’ll always be here to offer assistance and work you through a solution. Just let us know!
👍 1
l
Thanks for the clarification — I see that the API does indeed support the full set of operations (Get, Set, Delete) for SSO configuration. That said, I was actually hoping there would be an SDK-level method for updating role/group mappings specifically, rather than going directly through the API. From the docs, it looks like the Management SDK does not handle role mapping updates - unless I missed something?
n
So, you can manage Group Mappings from the SDK depending on which SDK you're using. We currently support SSO Management Node, Python, Go, Java as demonstrated here: https://docs.descope.com/management/tenant-management/sso/sdks
l
Yes, I’m using the Node SDK, and when I checked I saw this example:
Copy code
// Args:
//   tenantId (str): The tenant ID to be configured
const tenantId = "xxxxxx"
//    roleMappings (RoleMapping): A mapping between IDP groups and Descope roles.
const roleMapping = { groups: ['IDP_ADMIN'], roleName: 'Tenant Admin'}
//    attributeMapping (AttributeMapping): A mapping between IDP user attributes and descope attributes.
const attributeMapping = { name: "IDP_NAME", phoneNumber: "IDP_PHONE" }

let resp = await descopeClient.management.sso.configureMapping(
  tenantId,
  roleMapping,
  attributeMapping
)
What I don’t fully understand is the flow for updating an existing mapping. If a user adds a new mapping and then changes either the group name or the role associated with a group, how should I send the request? It looks like
configureMapping
only accepts a single object
n
For end users I would recommend using our SSO Setup Suite: https://docs.descope.com/auth-methods/sso/sso-setup-suite The SSO Setup Suite gives you full control over how your organization’s users log in with Single Sign-On (SSO). As an admin, you can: • Configure your identity provider (IdP): Connect Okta, Azure AD, Google Workspace, or any other supported IdP. • Manage group-to-role mappings: Decide which roles your end users should have in your application based on their IdP groups. For example, you can automatically assign “Viewer” to a Marketing group and “Admin” to an IT group. • Control the end-user experience: Customize the SSO setup and policies so that every login follows the rules you’ve defined. From the end user’s perspective, once SSO is enabled, all they need to do is sign in with their existing corporate credentials. They don’t manage new accounts or passwords. The roles and access they receive are handled entirely by your configuration. When you use
configureMapping
, it replaces the entire mapping set; it doesn’t patch a single group or role. So if you want to add, change, or remove a mapping, you’ll need to build the full list of role-to-group mappings you want and resend it in one call (e.g. as an array of mappings). That way any updates, renames, or new groups are reflected in the full configuration.
l
Thanks, @Nick Rodriguez! As mentioned earlier, the confusion stemmed from the SDK documentation example, which shows
roleMapping
as an object rather than an array of objects. The API is now working, and I was able to update the mapping successfully. However, I noticed that the Identity Provider (IdP) was deselected in Okta and reverted to a "Generic IdP" after the update. I only modified the group mapping, do you know if there’s a way to preserve the original IdP selection in Okta during this process?
r
Hey Lasha, this happened because of the SDK usage that changed the SSO configuration for that tenant. there is no functionality change, just a UI that does not display the Okta specific guides anymore, are you facing any issues with that?
l
Hey Reuven, thank you for confirming. Checked with rest of the team and we shouldn't have any issues since the functionality remains the same. I had one quick question: If a user deletes the SSO configuration using
deleteSettings
, and a user is authenticated via SSO, should we also log them out at that point?
n
Hi Lasha, Yes, force-logout would be the best practice in this situation.
🙌 1
l
Great, thank you both!
Final question for the group mapping effort. What can i use to set the Groups attribute name field shown here? Can this be done using the Management SDK?
n
Hey Lasha, Yes. You can use attribute mapping from the Management SDK to set the Groups attribute name: https://docs.descope.com/api/management/tenants/sso/configure-sso-saml-settings