CreateEnvironmentAccessToken
client.environments.createEnvironmentToken(EnvironmentCreateEnvironmentTokenParams { environmentId } body, RequestOptionsoptions?): EnvironmentCreateEnvironmentTokenResponse { accessToken }
POST/gitpod.v1.EnvironmentService/CreateEnvironmentAccessToken
Creates an access token for the environment.
Generated tokens are valid for one hour and provide environment-specific access permissions. The token is scoped to a specific environment.
Examples
-
Generate environment token:
Creates a temporary access token for accessing an environment.
environmentId: "07e03a28-65a5-4d98-b532-8ea67b188048"
CreateEnvironmentAccessToken
import Gitpod from '@gitpod/sdk';
const client = new Gitpod({
bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
});
const response = await client.environments.createEnvironmentToken({
environmentId: '07e03a28-65a5-4d98-b532-8ea67b188048',
});
console.log(response.accessToken);{
"accessToken": "accessToken"
}Returns Examples
{
"accessToken": "accessToken"
}