Skip to Content
How-to guides

Rotate a client secret without downtime

Replace a sajn ID Inloggning client secret while the previous one keeps working until your backend has the new one

When you replace a client's secret, the previous secret can keep working for 24 hours or 7 days. Your backend switches to the new secret during that time, and no login fails.

Before you begin

  • The client uses Hemlighet under Så autentiserar sig er backend.
  • You can deploy a configuration change to your backend within the overlap you pick.

Replace the secret

  1. In the sajn dashboard, go to Inställningar > Utvecklare > sajn ID Inloggning and open the client.
  2. Open the Uppgifter tab and click Byt hemlighet.
  3. Choose how long the previous secret keeps working:
    • 24 timmar if you can deploy within a day.
    • 7 dagar if the change passes through more steps, such as a review or several environments.
  4. Click Byt hemlighet.
  5. Copy the new secret from the Ny hemlighet skapad dialog. It starts with sajn_login_sec_, and the dashboard shows it only this once.
  6. Click Jag har sparat hemligheten.

The Uppgifter tab now shows Den tidigare hemligheten fungerar till with the date and time that the previous secret stops working.

Deploy the new secret

  1. Put the new secret in your backend's configuration, and deploy.
  2. Sign in once through your app to check that the token exchange works.
  3. On the Uppgifter tab, click Stäng av den nu, and confirm with Stäng av. The previous secret stops working at once.

If you skip step 3, the previous secret stops working when the overlap ends.

If you replace the secret again during an overlap, the oldest secret stops working at once. sajn keeps at most two secrets: the newest, and the one before it until its overlap ends.

If the secret has leaked

Replace the secret with Stäng av den gamla direkt instead of an overlap. The previous secret stops working at once, so token exchanges fail until your backend has the new secret. Deploy it as fast as you can.

Was this page helpful?

Last updated on