Skip to content

Access tokens and logins

Everything that acts on your account without you at the keyboard uses its own access token: a CI pipeline, a script, an AI assistant, each computer you ran pbc login on. Each one can be seen, limited and revoked on its own, and none of them can touch billing or your account settings, or create tokens. Those stay in the portal, signed in as yourself.

Who Token Created by
CI and scripts pbc_a_… You, on the Account page
An AI assistant pbc_c_… Connecting it (see Connecting an AI assistant)
A computer running pbc pbc_d_… pbc login, after you confirm it
A GitHub Actions run pbc_a_…, 15 minutes A trusted repository, with no stored secret

Create a token

Using the portal

  1. Open Account and find Access tokens
  2. Click Create token
  3. Click Copy. The token is shown once

That token deploys every project you can reach, including ones you create later, can set environment variables and domains, and never expires. To narrow it, open Limit it before clicking Create token:

Limit Choices
Name Anything that tells you where it lives
Project All projects, or one
Where it can make changes Everywhere; previews only; or previews and chosen environments of one project
Permissions Read, Deploy, Environment variables, Domains (default); Database, Database admin
Expiry Never (default), 30 days, 90 days, 1 year

A token limited to some environments can still read live, but a deploy, env change or ship that would change live is refused.

Using the CLI

Tokens are created only in the portal, signed in as yourself, so a stolen login can never make a token that outlives it. pbc token create opens the page:

pbc token create

Use a token

Store it as a secret named PBC_TOKEN and the CLI uses it for every command:

export PBC_TOKEN=pbc_a_…
pbc whoami

The CI/CD reference covers GitHub Actions and other runners.

See, roll and revoke tokens

Using the portal

Account → Access tokens lists every token and login with its limits, when it was last used and from where. Roll gives a token a new secret with the same limits and stops the old one; Revoke stops it at its next request without signing anyone out. Revoked and expired tokens are hidden behind Show revoked and expired.

Using the CLI

pbc token ls                     # tokens and logged-in computers
pbc token revoke pbc_a_AbCd      # by id or the start of its prefix

Rolling is a portal action, since it creates a token.

Sign in a computer

Using the portal

When pbc login runs, open the portal’s Confirm device page and type the code your terminal shows. The page then names the computer asking and when it started. Approve only if you just ran pbc login and the code matches.

Using the CLI

pbc login     # prints a code such as BCDF-GHJK and opens the confirm page
pbc logout    # signs this computer out, on the server too

If the server cannot be reached, pbc logout still forgets the login and warns; revoke it under Account → Access tokens. A login saved by an older pbc holds a personal session token, which pbc logout cannot end on the server; use Sign out everywhere.

On a computer without a browser, open the printed link on any device. A computer’s login can do what you can, except billing, account settings and creating tokens; for those, pbc opens the portal page instead.

Sign out everywhere

Using the portal

Account → Sign out everywhere signs you out of every browser, ends every pbc login, and stops any personal session token you stored in CI. Access tokens and assistant connections keep working; revoke those one by one.

Using the CLI

The CLI has no command for this, since it ends the CLI’s own login too. Use the portal.

Deploy from GitHub without a secret

GitHub can vouch for a workflow run, and PocketBase Cloud trades that proof for a 15-minute token, so nothing secret is stored in GitHub.

Using the portal

  1. Open the project’s Settings
  2. Under Deploy from GitHub without a secret, click Add repository
  3. Enter owner/name and the branch that deploys live, optionally a GitHub environment, then click Add. Without a branch, limit the trust to previews under Limit it.

Using the CLI

Trusts are managed in the portal: a trust creates tokens, and tokens are created only from a signed-in session.

Then give the workflow job id-token: write and leave out the action’s token input; see Deploy without a secret.

Personal session tokens

Older setups stored the portal’s personal session token in CI, and older versions of pbc saved one at login. Both still work until the token expires, and pbc and the GitHub Action print a warning when they see one, but it can do anything your account can and lasts 30 days. The portal no longer shows it. Replace it with an access token, and run pbc login once to replace a saved one.