Docs/Security/Access Tokens

Access Tokens

Learn how to create, manage, and use Personal Access Tokens (PATs) to authenticate with DepAegis across npm, NuGet, Docker, and CI/CD pipelines.

What Are Access Tokens?

Access tokens (also called Personal Access Tokens or PATs) are long-lived authentication credentials that replace passwords in automated workflows. Instead of typing your password every time you publish a package or push a container image, you create a token and use it in your tool configuration.

DepAegis tokens are prefixed with dap_ (e.g. dap_abc123def456...) and can be scoped to specific permissions and organizations.

Tokens are not passwords. They are scoped, revocable, and auditable. Every API call made with a token is logged with the token name, making it easy to trace activity.

Creating Tokens in the Dashboard

  1. Open the DepAegis dashboard and navigate to Settings → Access Tokens.
  2. Click New Token.
  3. Fill in the token details:
    • Name — a descriptive label (e.g. npm-ci, docker-dev).
    • Scope — the permission level (see below).
    • Expiration — when the token expires.
    • Organization (optional) — restrict to a specific organization.
  4. Click Create and copy the token value immediately. It will not be shown again.
Copy the token immediately after creation. DepAegis stores only a hashed representation and cannot recover the original value. If you lose a token, revoke it and create a new one.

Token Scopes

Scopes control what a token can do. Choose the narrowest scope that satisfies your use case:

ScopePermissionsTypical Use
readInstall, restore, pull packages and imagesDeveloper workstations, production servers
writeAll read permissions + publish, pushCI/CD publish pipelines
adminAll write permissions + delete, manage org settingsOrganization administrators
org:manageManage organization members, billing, and policiesOrganization owners
Create separate tokens for separate concerns: a read-scoped token for production servers, a write-scoped token for CI/CD, and an admin token stored in a secrets manager for administrative operations.

Token Expiration Settings

Every token has an expiration date. DepAegis supports the following expiration options:

Avoid tokens that never expire. If a no-expiry token is leaked, it remains valid indefinitely. Use short-lived tokens and rotate them regularly.

Using Tokens with npm

Configure your .npmrc file to use a DepAegis token for authentication. The token goes in the _authToken field:

Environment variable (recommended)

//app.depaegis.com/:_authToken=${DEPAEGIS_TOKEN}

Set the DEPAEGIS_TOKEN environment variable in your shell or CI configuration. This keeps the token out of your source tree entirely.

Hardcoded token

//app.depaegis.com/:_authToken=dap_abc123def456...
Never commit a hardcoded token to version control. If you use a project-level .npmrc, always reference an environment variable. Add any .npmrc containing real tokens to your .gitignore.

For full npm setup instructions, see the Configuring npm guide.

Using Tokens with NuGet

Pass the token as the --api-key when pushing packages:

dotnet nuget push MyPackage.1.0.0.nupkg \
  --source "https://app.depaegis.com/api/v1/nuget/v3/index.json" \
  --api-key "dap_abc123def456..."

To avoid passing the key on the command line, store it with dotnet nuget setapikey:

dotnet nuget setapikey "dap_abc123def456..." \
  --source "DepAegis"

Or configure it in nuget.config using environment variable substitution:

<packageSourceCredentials>
  <DepAegis>
    <add key="Username" value="token" />
    <add key="ClearTextPassword" value="%DEPAEGIS_TOKEN%" />
  </DepAegis>
</packageSourceCredentials>

For full NuGet setup instructions, see the Configuring NuGet guide.

Using Tokens with Docker

Authenticate Docker against the DepAegis container registry using a token as the password:

echo "dap_abc123def456..." | \
  docker login app.depaegis.com -u your-username --password-stdin

You can also use the token directly (less secure — visible in shell history):

docker login app.depaegis.com -u your-username -p "dap_abc123def456..."
In CI/CD, always use --password-stdin and read the token from a secrets variable. This prevents the token from appearing in build logs.

For full Docker setup instructions, see the Configuring Docker guide.

Using Tokens in CI/CD

In automated pipelines, store the token as a secret environment variable and reference it in your tool configuration. Here are patterns for common CI/CD platforms:

GitHub Actions

# Store DEPAEGIS_TOKEN as a repository secret
# Settings → Secrets and variables → Actions → New repository secret

- name: Publish npm package
  run: npm publish
  env:
    DEPAEGIS_TOKEN: ${{ secrets.DEPAEGIS_TOKEN }}

- name: Push Docker image
  run: |
    echo "${{ secrets.DEPAEGIS_TOKEN }}" | \
      docker login app.depaegis.com -u "${{ secrets.DEPAEGIS_USERNAME }}" --password-stdin
    docker push app.depaegis.com/my-org/my-app:${{ github.sha }}

GitLab CI

# Store DEPAEGIS_TOKEN as a CI/CD variable
# Settings → CI/CD → Variables

publish:
  stage: deploy
  script:
    - npm publish
  variables:
    DEPAEGIS_TOKEN: $DEPAEGIS_TOKEN

Azure DevOps

# Store DEPAEGIS_TOKEN as a pipeline variable (secret)
# Pipelines → Library → Variable groups

- task: NuGetCommand@2
  inputs:
    command: push
    publishFeedCredentials: DepAegis
  env:
    DEPAEGIS_TOKEN: $(DEPAEGIS_TOKEN)
For detailed CI/CD integration guides, see GitHub Actions, GitLab CI, and Azure DevOps.

Token Rotation Best Practices

Regularly rotating tokens limits the damage window if a token is leaked. Follow these guidelines:

  1. Set explicit expiration dates on every token (30–90 days for CI, 90–365 days for workstations).
  2. Create a replacement token before the current one expires. Update all references, then revoke the old token.
  3. Use separate tokens per environment — one for CI, one for development, one for production. This limits blast radius if one is compromised.
  4. Audit token usage — review the Settings → Access Tokens page periodically to identify unused or stale tokens.

Revoking Tokens

If a token is compromised, revoke it immediately:

  1. Navigate to Settings → Access Tokens.
  2. Find the token in the list.
  3. Click Revoke (or the trash icon).

Revocation is instant — all API calls using the revoked token will return 401 Unauthorized within seconds.

Via REST API

curl -X DELETE \
  -H "Authorization: Bearer $DEPAEGIS_ADMIN_TOKEN" \
  "https://app.depaegis.com/api/v1/tokens/dap_abc123def456..."
If you revoke a token that is currently in use by a CI pipeline, the pipeline will fail on its next run. Always rotate by creating a replacement token first, updating all references, and then revoking the old one.

Security Best Practices