Create a key
A Fauna key, or access token, gives a client application access to a Fauna database.
Each key has an assigned role. Keys support both built-in and user-defined roles.
This tutorial shows how you can create a key using:
-
The Fauna Dashboard
-
An FQL query using the
Key.create()
method
Create a key using the Dashboard
To create a key in the Dashboard:
-
Go to the Fauna Dashboard and sign in.
-
In the left navigation, click Explorer.
-
Expand your region group, select your database, and click the Keys tab.
-
Click Create Key.
-
Choose a Role and enter an optional Key Name.
-
Click Save.
-
Copy the Secret Key.
Create a key using Key.create()
To create a key using Key.create()
:
Key.create({
role: "server",
// Optional key name
data: {
name: "my-server-key"
}
})
To call Key.create()
, you must have the
create
privilege for the built-in Key
collection. The built-in admin
role
has this privilege.
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!