Arctic v1

Figma

For usage, see OAuth 2.0 provider.

import { Figma } from "arctic";

const figma = new Figma(clientId, clientSecret, redirectURI);
const url: URL = await figma.createAuthorizationURL(state, {
	// optional
	scopes
});
const tokens: FigmaTokens = await figma.validateAuthorizationCode(code);
const tokens: FigmaRefreshedTokens = await figma.refreshAccessToken(refreshToken);

Get user profile

Use the /me endpoint.

const figma = await discord.validateAuthorizationCode(code);
const response = await fetch("https://api.figma.com/v1/me", {
	headers: {
		Authorization: `Bearer ${tokens.accessToken}`
	}
});
const user = await response.json();