Hi!
We are working on a DS library that has a bunch of variables. We would like to get those variables to our codebase in Visual Studio Code, with Code Connect. I have cloned the “simple design sample” (https://github.com/figma/sds), but when I try to run the script for processing the variables, I get an error, that apparently says that I don’t have “read or write” permissions for “file_code_connect”.
This is the error that appears on my console:
response {
status: 403,
error: true,
message: 'Invalid scope(s): file_code_connect:read, file_code_connect:write, file_comments:read, file_comments:write, current_user:read, file_dev_resources:read, file_dev_resources:write, file_content:read, file_versions:read, library_assets:read, library_content:read, projects:read, team_library_content:read, webhooks:read, webhooks:write. This endpoint requires the file_variables:read scope'
}
nameSpace com.figma.sds
file:///Users/bruno.sastre/Desktop/genexus/figma-sds/scripts/tokens/fromFigma.mjs:99
const collections = Object.values(response.meta.variableCollections).filter(
^
TypeError: Cannot read properties of undefined (reading 'variableCollections')
at variablesRESTResponseToVariablesJSON (file:///Users/bruno.sastre/Desktop/genexus/figma-sds/scripts/tokens/fromFigma.mjs:99:51)
at getFileVariables (file:///Users/bruno.sastre/Desktop/genexus/figma-sds/scripts/tokens/fromFigma.mjs:37:12)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async initialize (file:///Users/bruno.sastre/Desktop/genexus/figma-sds/scripts/tokens/app.mjs:89:24)
I understand that to use code connect I have to be part of a organization, which I am already, called Genexus:

The steps that I have done:
- Logged in to my Genexus organization
- Created a Team called “Mercury Tests”
- Created a Project insite “Mercury Tests” called “Tokens”
- Copied my variables library into “Tokens” project.
- Then, I went to “Settings” > “Security” > “Generate new token”.
- I gave access to all scopes

- Generate the token, and copy the token
- On the sds cloned project, I created the .env file, and upadted the consts:
- Run npm run script:tokens:rest
- Got the terminal error that I mentioned above.
Then, I chated with gpt, and this is the apparent explanation:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Yeah, that confirms it — file_variables:read
isn't in the list, which is why you’re getting the 403.
Figma doesn't include that scope in the regular token UI yet. To access variables via Code Connect, you need to be part of a team/org with Code Connect for Variables enabled (it's still in limited beta as of now).
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
As far as I can see, there seems that some scopes are missing from my list. I am already a member of an Org. I am not the owner of the Org, but I have been invited. I need to be able to connect with the variables of my DS via Code Connect. ¿What should I do to enable the required permisions?
Thanks in advance.