Fetching styles from figma design system in libraries/assets

We are creating a plugin where we want to pull color and text styles from Figma design system in libraries/assets through Figma plugin API. But none of the solutions are working.

Here are the methods that i tried.

  1. I tried using fetch meta styles using Figma API. I added access token and fileId in the headers.
    Here is the URL format i used - ${baseUrl}/v1/files/${fileId}/styles/${styleId}
    I got a cors issue. So added api.figma.com in allowedDomains in manifest.json. But I am getting forbidden error message.

  2. Using the same API method, i tried fetching through teamId and components.
    Here is the URL format I used - ${baseUrl}/v1/teams/${teamId}/components
    But I am still getting forbidden error message.

  3. I tried using this method - getAvailableLibraryVariableCollectionsAsync()
    But I am getting this error - “Property ‘getAvailableLibraryVariableCollectionsAsync’ does not exist on type ‘PluginAPI’”

  4. I tried using this method - getVariablesInLibraryCollectionAsync()
    But I am getting this error - “Property ‘getVariablesInLibraryCollectionAsync’ does not exist on type ‘PluginAPI’”

Can you please help me get through this?