Configuring Access Token

fairly can be used to access datasets owned by a user of a data repository. For 4TU.ResearchData and Zenodo, we can do that by configuring access tokens.

Creating a personal access token

A personal access toke allows to connect to a user account remotely without the need to a username and password.

Zenodo

  1. Register for a Zenodo account if you do not already have one.

  2. Go to your Applications, and click on New token under Personal access tokens.

  3. Enter a name for your token.

  4. Select the OAuth scopes you need (deposit:write and deposit:actions).

  5. Click Create

  6. An access token will be shown, copy it and store it. The token will only be shown once.

  7. Click on Save

4TU.ResearchData

  1. Register for a Zenodo account if you do not already have one.

  2. Go to your Applications, and click on Create Personal Token.

  3. Enter short description for your token, for example a name, and click on Save

  4. An access token will be shown, copy it and store it. The token will only be shown once.

  5. Click on Done

Connecting to an Account

Connecting to an account is a simple as passing a token when creating a 4TU.ResearchData or Zenodo client.

import fairly

# For 4TU.ResearchData
fourtu = fairly.client("figshare", token="<my-4tu-token>")

# For Zenodo
zenodo = fairly.client("zenodo", token="<my-zenodo-token>" )

Storing Tokens

Token can be stored on a user configuration files at ~/.fairly/config.json. You can add/modify tokens to repositories as follows. Stored tokens will be used by the Python API, CLI and JupyterLab extension, unless a different topen is passed when performing a task.

To store a token using the CLI, use:

fairly repository token <reposiotry-id> <your-token>

To check which repositories and token are configured, use:

fairly repository list