You may add, remove and interact with tokens using the CLI. By default tokens are stored in a secure keyring. We recommend using the keyring to store your tokens but you can also store them in a configuration file.
All commands related to tokens are available under the token subcommand.
snip tokenUsage: snip token [OPTIONS] COMMAND [ARGS]...Manage your tokens for authentication with a snip instance.╭─ Options ────────────────────────────────────────────────────────────────────╮│--keyring-kPARSE_KEYRINGSelect a keyring backend.││--helpShow this message and exit.│╰──────────────────────────────────────────────────────────────────────────────╯╭─ Commands ───────────────────────────────────────────────────────────────────╮│list List all available tokens. ││add Add a snip token your keyring storage. ││remove Remove a token from your keyring storage. │╰──────────────────────────────────────────────────────────────────────────────╯
You may add tokens to the keyring using the tokenadd command:
snip token addUsage: snip token add [OPTIONS] TOKENAdd a snip token your keyring storage.╭─ Arguments ──────────────────────────────────────────────────────────────────╮│*tokenTEXTToken string to add to the keyring.[required]│╰──────────────────────────────────────────────────────────────────────────────╯╭─ Options ────────────────────────────────────────────────────────────────────╮│--nameTEXT The name of the token, should be ││unique. If not provided, it will be ││prompted for. ││--type[book|account]The type of the token. Currently ││only 'book' and 'account' are ││supported. ││[default: book] ││--book-idINTEGER The book ID for the token. If not ││provided, it will be prompted for. ││--deployment-urlTEXT The deployment URL i.e. the URL of ││the snip instance. ││[default: ││https://snip.roentgen.physik.uni-go…││--helpShow this message and exit.│╰──────────────────────────────────────────────────────────────────────────────╯
You may also remove tokens from the keyring using the tokenremove command:
snip token removeUsage: snip token remove [OPTIONS] NAMERemove a token from your keyring storage.╭─ Arguments ──────────────────────────────────────────────────────────────────╮│*nameTEXTThe name of the token to remove.[required]│╰──────────────────────────────────────────────────────────────────────────────╯╭─ Options ────────────────────────────────────────────────────────────────────╮│--helpShow this message and exit.│╰──────────────────────────────────────────────────────────────────────────────╯
To get an overview of available tokens, you may list all tokens available in the keyring and through the configuration files using the tokenlist command:
snip token listUsage: snip token list [OPTIONS]List all available tokens.╭─ Options ────────────────────────────────────────────────────────────────────╮│--helpShow this message and exit.│╰──────────────────────────────────────────────────────────────────────────────╯
Troubleshooting
Token keyring management depends on the keyring package.
It is possible that a tokenadd command does not work as expected and tokens do not appear in the list if the NULL keyring backend is selected. This can be fixed by setting the keyring backend via the -k or using the env variable PYTHON_KEYRING_BACKEND.