Authentication

The pd4castr CLI uses a browser-based login flow to connect to your account. You log in once, and the CLI stores your credentials locally for subsequent commands.

Log in

Run the following command to authenticate:

pd4castr login

The CLI starts a device authorization flow and displays a verification URL and a login code:

ℹ Please open the login link in your browser:
	https://pdview.au.auth0.com/activate?user_code=ABCD-EFGH
ℹ Your login code is:
	ABCD-EFGH
⠋ Waiting for login to complete...

To complete the login:

  1. Open the verification URL in your browser.
  2. Enter the login code shown in your terminal.
  3. Sign in with your pd4castr credentials.

The CLI waits automatically and confirms when the login succeeds:

✔ Successfully logged in to the pd4castr API

If you’re already logged in with a valid token, the CLI skips the flow and displays:

✔ Already logged in!

Where credentials are stored

The CLI stores your authentication token in a file called .pd4castr in your home directory (~/.pd4castr). This file contains your access token and its expiration timestamp. The token is checked for expiry each time you run a command that requires authentication.

Note: Don’t edit the .pd4castr file manually. Use pd4castr login and pd4castr logout to manage your credentials.

Log out

To clear your stored credentials:

pd4castr logout
✔ Successfully logged out of the pd4castr API

Commands that require authentication

Not every CLI command needs you to be logged in. Here is a breakdown:

CommandRequires loginWhy
pd4castr initNoFetches templates from GitHub
pd4castr loginNoInitiates the login flow
pd4castr logoutNoClears local credentials
pd4castr fetchYesQueries platform data sources via the API
pd4castr testNoRuns entirely on your local machine
pd4castr publishYesCreates models, pushes images, uploads data

Troubleshooting

  • Token expired? Run pd4castr login again. The CLI automatically detects expired tokens and prompts you to re-authenticate.
  • Browser didn’t open? Copy the verification URL from your terminal and paste it into your browser manually.
  • Login timed out? The authorization code has a limited lifetime. If it expires, run pd4castr login again to generate a new code.

Next steps

Once you’re logged in, you can fetch test data from configured data sources and publish your model to the platform.