Token Management

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 token Usage: 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.                           ╰──────────────────────────────────────────────────────────────────────────────╯

Adding and Removing Tokens

You may add tokens to the keyring using the token add command:

snip token add Usage: snip token add [OPTIONS] TOKEN Add 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 token remove command:

snip token remove Usage: snip token remove [OPTIONS] NAME Remove a token from your keyring storage. ╭─ Arguments ──────────────────────────────────────────────────────────────────╮ *nameTEXTThe name of the token to remove.[required] ╰──────────────────────────────────────────────────────────────────────────────╯ ╭─ Options ────────────────────────────────────────────────────────────────────╮ --helpShow this message and exit. ╰──────────────────────────────────────────────────────────────────────────────╯

Listing available Tokens

To get an overview of available tokens, you may list all tokens available in the keyring and through the configuration files using the token list command:

snip token list Usage: 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 token add 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.

Either set the environment variable:

export PYTHON_KEYRING_BACKEND=keyring.backends.chainer.ChainerBackend

or using the -k flag:

snip token add -k keyring.backends.chainer.ChainerBackend