Reuse a Space when Flatfile is opened.
publishableKey
. We’ll then make a server-side request using our secretKey
to get the Space and its access token.
development
environment.
guestAuthentication
guestAuthentication
configured with shared_link
as an
option. This is inherited from the Environment you're working in, and more info can be found in your Developer Settings page in the platform.
shared_link
comes standard on all out-of-the-box Environments (develop
/ production
) so you shouldn't have to do anything unless you have created a custom Environment.
init
command.
public
and src.
The public
directory contains the index.html
file, which is the entry point of the application’s front-end, and the “style.css” file for styling the iframe.
The src
directory contains the main components and logic of the application, including the client.js
file, which initializes Flatfile and passes in available options. And the server.mjs
file, which sets up a Node.js server using Express that listens for incoming requests and communicates with the Flatfile API to retrieve data about a specified Space.
FLATFILE_API_KEY
is your Secret Key and SPACE_ID
is the Space you want to open in the importer. This is can be found on your Dashboard where it lists your Spaces. You shouldn’t need to update the BASE_URL
.
publishableKey
and a new Space will be created on each page load. Also, add the content here to your styles.css
.
client.js
, at minimum, you’ll need to get and pass the space
info. This code opens an existing Space in a modal by making a request to your server endpoint and initializing the Flatfile data import with specified options based on the server’s response.