0 / 0
Manually adding the project access token
Last updated: Oct 09, 2024
Manually adding the project access token

All projects have an authorization token that is used to access data assets, for example files and connections, and is used by platform APIs. This token is called the project access token, or simply access token in the project user interface. This project access token must be set in notebooks so that project and platform functions can access the project resources.

When you load data to your notebook by clicking Read data on the Code snippets pane, selecting the asset and the load option, the project access token is added for you, if the generated code that is inserted uses project functions.

However, when you use API functions in your notebook that require the project token, for example, if you're using Wget to access data by using the HTTP, HTTPS or FTP protocols, or the ibm-watson-studio-lib library, you must add the project access token to the notebook yourself.

To add a project access token to a notebook if you are not using the generated code:

  1. From the Manage tab, select Access Control and click New access token under Access tokens. Only project administrators can create project access tokens.

    Enter a name and select the access role. To enable using API functions in a notebook, the access token must have the Editor access role. An access token with Viewer access role enables read access only to a notebook.

  2. Add the project access token to a notebook by clicking More > Insert project token from the notebook action bar.

    By running the inserted hidden code cell, a project object is created that you can use for functions in the ibm-watson-studio-lib library. For example to get the name of the current project run:

    project.get_name()
    

    For details on the available ibm-watson-studio-lib functions, see Accessing project assets with ibm-watson-studio-lib.

    Note that a project administrator can revoke a project access token at any time. An access token has no expiration date and is valid until it is revoked.

Parent topic: Loading and accessing data in a notebook

Generative AI search and answer
These answers are generated by a large language model in watsonx.ai based on content from the product documentation. Learn more