Can I call Figma REST API in plugin? Import style from library issue!

Hi all, I am working on a Figma plugin that needs to import style from our team library. Through research I think the way is to first use Figma REST API to get the keys of styles from our library file, and the use figma.importStyleByKeyAsync() to import the style. However, the issue is, this requires me to put my Access token in the plugin, and I don’t want to. Is there a way for plugin to authenticate when making REST API calls on behalf of the person who uses the plugin?

Or are there any other easier ways to import/access styles from team library file in plugin? Thanks a lot!!!

You have several ways:

  1. Users will create their own personal access tokens, which will be inserted into the input field of your plugin.
  2. Users will open the necessary library files, run the plugin there to get the necessary keys, return to another file to continue working.
  3. Hardcode the keys in the plugin.
    3.1. Or add these keys to, for example, a JSON file that you or anyone else can keep updating as needed.

Hi, thanks for the reply! I see, I will give option 3 a try, to hard code the keys in the plugin, and keep the plugin for internal use first. The other ways seem to have some extra steps for people who uses plugin.