Skip to content
LogoLogo

Service accounts

A service account is an identity of one workspace for a script or a CI job. It has a role, acts as itself and appears in the audit log under its own name. It keeps working when the person who set it up leaves. It signs in with a secret, or with a token that an outside service such as GitHub Actions issues, and gets an access token for one hour. A service account is not the account at another system that the connect dialog under Connectors recommends.

Who can do this: admins of the workspace with debug mode. Debug mode is operator tooling that a platform admin turns on for their own account, so customers do not see this section.

Create a service account

  1. Open Settings, then Members, and scroll to Service accounts.
  2. Enter a name, such as "Nightly export", choose Member or Admin and select Create.
  3. The account shows with its Client ID. It cannot sign in until you add a secret or a rule.

Add a secret

  1. Next to the service account, select Add secret.
  2. Choose how long it is valid under Valid for: 30, 90, 180 or 365 days. Select Create secret.
  3. Copy the secret now. It is shown once.
  4. Before it expires, select Replace. The old secret keeps working until it expires.

Add a rule for an outside service

  1. Next to the service account, select Add rule.

  2. Enter the Issuer, the Audience and the Subject that the service's token carries. Use the GitHub Actions example fills in the values for GitHub Actions.

  3. Name the repository and the branch in Subject. * stands for any run of characters, and a subject that is only * accepts every job of that issuer.

  4. Select Add rule. No secret is stored.

    The service account Nightly export with the role member, created by Anna Berger, its Client ID and a Disable button. It has an External token rule with the issuer https://token.actions.githubusercontent.com, the audience discontinue and a subject for the main branch of one repository. Below are the buttons Add secret and Add rule.
    A service account with a rule for GitHub Actions.

Get an access token

  1. Send the client ID and the secret, or the client ID and the outside token, to POST https://discontinue.dev/api/v1/auth/machine/token:

    curl https://discontinue.dev/api/v1/auth/machine/token \
      -H "Content-Type: application/json" \
      -d '{"grantType": "client_secret", "clientId": "<client id>", "clientSecret": "dsas_..."}'
  2. The answer holds an access token for one hour. Renew it with "grantType": "renew" for up to 24 hours. After that, sign in with the secret or the rule again.

Good to know

  • No part of the Discontinue API accepts a service account's token yet. Calls with it are refused.
  • Adding or replacing a secret or a rule, and deleting or enabling the account, asks you to confirm it's you when your last sign-in is older than 10 minutes.
  • Delete removes the account for good, with its secrets, rules and tokens. Scripts that used them stop working. This cannot be undone.
  • Disable stops every token of the account at its next request. Enable lets it sign in again.
  • Five wrong secrets within a minute block the secret for five minutes.
  • Admins are emailed 14 and 3 days before a secret expires.