Quader Docs 0.176.0

Personal access tokens

Let a tool such as npm, docker or curl act as you without your password, with only the repositories and actions it needs.

On this page

What a token is

  • A token acts as you, never with more than your own permissions and project roles; its scope only narrows them. While your account is disabled, it does not work.
  • Its value is shown once. Quader keeps only a hash; nobody can show it again.
  • A client sends it as a bearer token (Authorization: Bearer <token>) or as the password of HTTP Basic authentication with any user name, unless an administrator switched Basic off. Your browser session needs no token.
Prefix Type Created by
qdr_pat_ Personal access token You
qdr_sat_ Service-account token An administrator or an Owner of the account's project (Managing tokens)
qdr_cit_ CI token A GitLab CI job, by the exchange (GitLab CI pipelines)

A token is 57 characters: the prefix, 43 random characters and a checksum that catches a typo. Lists show its hint, such as qdr_pat_Ab3x. A container client signed in with a token gets a short-lived qdr_rgt_ registry token, which ends with it.

Create a token

  1. User menu › Profile and tokens opens Personal tokens; select Create token.
  2. Fill in the form and select Create token. Quader may ask you to sign in again first; your entries stay.
  3. Your new token shows the value: Copy it to where your tool reads it, then I have copied it.
Field What to enter
Description What the token is for, the machine or the job
Lifetime Server default (90 days), 7 days, 30 days, 90 days, 1 year or Custom date (expires at the end of that day, UTC); at most one year unless an administrator set otherwise
Scope All repository permissions of the owner, without administration (preselected), Only the repositories and actions below, or for an administrator Administrator: everything on this installation
Repositories With a restricted scope: web/npm-internal or a pattern such as web/npm-team-*, one per line, always with the project
Package patterns (optional) Such as @team-a/*; empty means every package
Actions With a restricted scope: read, annotate, deploy, overwrite, delete, manage
Endpoints Shown if you may read endpoints: binds the token to the endpoints you tick

You hold at most 50 active tokens; an installation can allow tokens only to some groups (auth.tokens). A token made here carries no system role: as an Owner you act through it as a Maintainer.

Choose the scope

Give each tool its own token with only what it needs. Through a virtual repository, list its members too.

Task Actions
Install, download, read a Debian repository (without package patterns) read
Publish a package, push a NuGet package, set a dist-tag read, deploy
Upload a new file or Debian package deploy
Replace a file with other bytes deploy, overwrite
Unpublish, unlist or delete an npm or NuGet version read, delete
Delete a file, remove a Debian package delete

A token with a restricted scope cannot change your profile or preferences, see your sessions, or reach your tokens but itself and those created with it. Permissions explains the actions.

Rotate, revoke, expire

Act What happens
Rotate A new value, same description and scope; the old one stays valid Not at all, One hour or One day
Revoke Ends the token on every replica within seconds, for good, with the tokens created from it
Revoke all tokens In Advanced at the end of the page
Expiry The token answers 401 invalid_token; nothing renews it. Show revoked and expired tokens lists it until its record is deleted, 90 days later by default

Warning

A leaked token: revoke it at once. Anyone holding the value can revoke it by sending {"token": "<value>"} to POST /api/v1/tokens/revoke, without signing in.

Use a token

Keep the token in the environment variable QUADER_TOKEN and let the client read it, so no file holds the secret. Set up client on a repository shows how (Connecting a package client).

With curl and the management API

Hand the token to curl on standard input, so it stays out of the command line and the process list:

shell
quader_curl() {
  curl --silent --show-error --config - "$@" <<EOF
header = "Authorization: Bearer ${QUADER_TOKEN}"
EOF
}
quader_curl --fail https://quader.example.com/api/v1/tokens/current   # example: describes this token

The token operations, such as revoking the token of the request as a job's last step, are in the API reference.

Personal and service-account tokens

Personal token Service-account token
Acts as You A service account, independent of a person
For Your own machine and tools CI jobs and other automation
Lifetime Always expires Expires, or never where the installation allows
Further endpoints Refused unless an administrator allows them Accepted by default

A GitLab CI job needs neither: it exchanges its ID token for a CI token (GitLab CI pipelines).