How to create and use Personal Access Tokens in CodeScene?

Personal Access Tokens (PATs) provide a secure way to access CodeScene APIs with a user's specific permissions. They are especially useful for integrating the VSCode plugin or the CLI tool. 

Creating Personal Access Tokens

To generate a Personal Access Token, follow these steps:

  1. Navigate to the Configuration menu in CodeScene.
  2. Click on the Authentication tab.
  3. In the Internal User Management section, you'll find the Personal Access Tokens button. Use this to create your token.

Once created, you can use the token for API access as needed. Each user is responsible for generating and managing their own token.

Administrator Privileges

Administrators in CodeScene have the ability to list and delete Personal Access Tokens for other users. This is useful for maintaining security and ensuring that expired or unused tokens are removed promptly.

Setting Up Environment Variables

To use the Personal Access Token in CLI tool, users must set the following environment variables:

  1. CS_ONPREM_URL or CS_ONPREM_API_URL (the latter should include /api/v2 at the end).
  2. CS_ACCESS_TOKEN, which should be set to the generated Personal Access Token.

These settings ensure that the token is properly utilized by CodeScene's CLI tool for authentication and API access.

By following these steps, users can securely access and integrate CodeScene's functionalities into their workflow.