Skip to main content
Create a revocable token for accessing the Gradle cache. nsc cache gradle create-token generates a revocable token that’s pre-scoped to the permissions needed to read from and write to your Gradle build cache, so CI/CD pipelines and other non-interactive environments can authenticate without going through the interactive login flow. It’s a narrower, purpose-built counterpart to nsc token create — instead of specifying a --grant yourself, the token is automatically scoped to Gradle cache access. This same command is also invokable as nsc gradle cache create-token. The generated token is written to a JSON file that can be passed to nsc cache gradle setup to configure a Gradle init script that authenticates with it. Like other revocable tokens, it can be revoked at any time from cloud.namespace.so/user/sessions or with nsc token revoke.

Usage

Example

1

Create a token

Create a token for the default Gradle cache with a 30-day expiration and write it to gradle-token.json:
2

Configure Gradle

Pass the token file to nsc cache gradle setup to generate an init script that authenticates with it:

Options

—cache_name

Select a Gradle cache to grant access to. By default, all Gradle caches can be accessed.

—expires_in

Duration until the token expires. Defaults to 2160h (90 days). Available time units are: h (hours), d (days), w (weeks), and y (years).

—scope

Set the scope of the generated access token. Valid options: tenant, user. Defaults to user. Tokens with user scope are bound to the tenant membership of the current user; tenant scope isn’t tied to a specific user’s workspace membership.

—token

Write the token to this file in JSON format. Defaults to token.json. Pass this file to nsc cache gradle setup --token <path> to authenticate with it.
Last modified on August 20, 2026