Guide

Directory sync (SCIM): removing leavers automatically

Larger customers want one thing from your app that has nothing to do with features: when someone leaves their company and is switched off in the company directory, they must lose access to your product the same day.

6 min read · Last checked

In short

Key points

  • SCIM 2.0 is the standard way an identity provider such as Okta or Microsoft Entra ID tells your app about users joining, changing and leaving.
  • TenancyEngine gives each customer’s IT admin a one-time setup link that shows the SCIM address and lets them create a token.
  • Deactivating a person suspends them and signs them out. Nothing is deleted.
  • SCIM keeps the user list in step. It is not SAML single sign-on, which TenancyEngine does not offer.

Why enterprise buyers ask for it

A customer’s security team has one list of staff. If your app keeps its own list, someone has to remember to remove leavers from it by hand. SCIM lets their identity provider do that for them, which is why it shows up on security questionnaires.

How the setup works

  • From your backend, mint a one-time setup link for one customer. The API key needs the setup-links.write scope, which is not part of any broad scope.
  • Send the link to the customer’s IT admin. It opens once within 5 minutes of creation, and the setup page then stays available for 7 days. A new link for the same customer stops the previous one immediately.
  • On the page the admin copies the SCIM base URL, creates a bearer token (shown once, valid for 180 days) and pastes both into a SCIM 2.0 application in their identity provider.
  • The page uses your application’s own name, logo and colour, so the customer sees your brand.

What happens when a person is deactivated

Setting a user to inactive suspends the account and revokes refresh tokens and cookie sessions. A person who also belongs to another customer’s tenant keeps that access; the account is locked only once no active tenant is left. Reactivating lifts only a suspension that SCIM itself applied.

What SCIM can and cannot do here

  • It can list, read, create, update, patch and delete users, using the filters userName, emails.value, externalId and id.
  • New users get the member role and no password; they sign in through your app’s sign-in.
  • SCIM cannot grant an admin role.
  • Deleting a user through SCIM suspends and signs them out, and removes them from that tenant.

Hear about it in your own app

Subscribe your webhook endpoint to directory.user.created, directory.user.updated and directory.user.deactivated. Each payload carries the organization, application, tenant and user ids and the email, and is signed like every other application webhook. Use them to clean up anything your own database holds for that person.

Honest limits

What to know before you rely on this

  • TenancyEngine does not offer SAML single sign-on. If a customer requires SAML, use a specialist identity vendor for that part.
  • SCIM is scoped to one customer’s tenant, and its base URL and token are per tenant.
  • Groups and role assignment through SCIM are not documented. Roles beyond member are managed in your app or the console.

Questions people ask

Does SCIM delete the person’s data?

No. Deactivation suspends the account and signs the person out. Nothing is deleted. Erasure is a separate, deliberate process.

Can I give the setup link to a customer more than once?

Yes. Creating a new link stops the previous one at once, and the old link can also be revoked on its own.

Is the setup link logged?

No. It travels in the URL fragment and is never logged.

Sources

Keep reading

Try it on the free plan

One app and five customers, no credit card required.

Request access More guides