In order to use Haiku Animator's Figma integration, a service must be running to perform OAuth2 token exchange. Read more about OAuth with Figma and the Figma HTTP API here: https://www.figma.com/developers/api#oauth2
This project is a minimal self-hosted HTTP server application written in Go that will perform the token exchange for you.
- Figure out the public URL and port where you will host this server. This guide will use the made-up example http://animatorfigmaauth.na:8080/ . Using TLS/HTTPS is recommended and can be achieved by specifying the
TLS_*environment variables in step 4. - Log into Figma and register a new app at: https://www.figma.com/developers/apps . The
nameandlogocan be whatever you want. Thewebsite URLmust be the public URL from step 0 along with the path /v0/integrations/figma/token, e.g.http://animatorfigmaauth.na:8080/v0/integrations/figma/token - Add this callback URL to your registered app:
haiku://oauth/figma - Save your app, then take note of the Figma-provided client ID and client secret — these values should be set to FIGMA_CLIENT_ID and FIGMA_CLIENT_SECRET in env (see .env.example)
- Build and serve this application at the URL and port from step 0, having loaded the relevant
envafter copying.env.exampleinto.envand filling in the relevant values. Once.envexists, you can use this one-liner to build, load env, and run the server:go build && export $(grep -v '#.*' .env | xargs) && ./figma-auth. You can test that your server is accessible viaGET /v0/ping, e.g. in your browser at http://animatorfigmaauth.na:8080/v0/ping . If the server is accessible, you should see the responsepong. - Specify that Haiku Animator should use your service for Figma auth — for now this requires building Animator from source
HAIKU_API=http://animatorfigmaauth.na:8080/ FIGMA_CLIENT_ID=get_this_from_figma yarn go(from root of https://github.com/HaikuTeam/animator)
This code is dual-licensed under Apache 2.0 and MIT.