Note: Retool currently only supports connecting to Fauna via our GraphQL integration.
Authentication with Fauna in Retool is pretty simple: we just need to get an API Key and then include it in requests as a bearer token in the header. To keep things even simpler, we'll set Fauna up as a GraphQL resource so that header gets added automatically to every request.
Follow these steps to generate a Fauna API Key:
In the Fauna UI, click on the [Security] button in the left sidebar. Then, click the [New Key] button.
In the "New key" form, the current database should already be selected. For the "Role" field, leave it as "Admin". Optionally, add a key name...say “Retool”. Next, click [Save] and copy the key’s secret displayed on the next page. It is never displayed again, so make sure you put it somewhere safe!
At this point we’ll hop over to Retool with our key and do the rest of our work there. Head over to your Resources tab, click "create new" and choose GraphQL from the resource list. Fill in the following values:
- Name: Give it a name of your choice, e.g. “faunadbGQL”
- Base URL: Depending on which Region Group your database lives, use one of the following values:
- Authorization: Bearer <API_KEY>
- Accept-Encoding: gzip, deflate, vr
- Content-Type: application/json
- Accept: application/json
- Connection: keep-alive
- DNT: 1
For more information on writing queries and building a basic to do list app, check out Fauna's Retool docs.
Updated 13 days ago