In order to interface with Cytobank via the API (for example, using the CytobankAPI R package), users must authenticate. This can be done either with a username and password or by generating an API token, as is recommended if this authentication step will be saved in a script. This guide will take you step by step through generating an API token within the Cytobank interface, and will show you how to authenticate via the CytobankAPI R package.
- Login to your Cytobank via your credentials.
- Access the Account Settings page by clicking on your username dropdown menu at the top-most navigation bar (1). Click on the Account Settings item (2).
- Once on the Account Settings page, find the API Token section and click Generate API Token.
- Once the Generate API Token button is clicked, a box will appear with your API Token. This token lasts for 8 hours, after which you must create a new one.
- Authenticate via the CytobankAPI R package by copying the code below, and replacing premium with your Cytobank site, cytobank_user with your login username, and CYTOBANK_AUTH_TOKEN with the API token that was generated from the previous step.
cyto_session <- CytobankAPI::authenticate(site="premium", user="cytobank_user", auth_token="CYTOBANK_AUTH_TOKEN")