Check out v4 of the Fauna CLI
v4 of the Fauna CLI is now in beta. The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start. |
Token
A token is a type of authentication secret used to provide identity-based access to a Fauna database.
You typically create and use tokens as part of a Fauna-based end-user authentication system.
Token
collection
Fauna stores tokens as documents in the Token
system collection.
Token
documents have the following FQL structure:
{
id: "401671202234433613",
coll: Token,
ts: Time("2099-06-25T13:32:39.240Z"),
ttl: Time("2099-06-27T13:32:39.240Z"),
document: Customer("401670531121676365"),
secret: "fn..."
}
Field name | Value type | Description |
---|---|---|
|
A unique identifier for a token. Fauna assigns this value at creation. |
|
|
|
|
|
Creation timestamp, with microsecond resolution and time zone. |
|
|
Timestamp indicating a document lifespan. When the |
|
|
The identity document associated with the token. |
|
|
Randomly generated cryptographic hash. Equivalent to a password. |
|
|
User-defined metadata for the token. |
Static methods
You can use the following static methods to manage the Token
collection in
FQL.
Method | Description |
---|---|
Get the Set of all Token objects. |
|
Get a Token by Document. |
|
Get a Token by ID. |
|
Create a Token. |
|
Get the first token matching a predicate function. |
|
Get the name of the Token collection as a string. |
|
Get tokens matching a predicate function. |
Instance methods
You can use the following instance methods to manage specific Token
documents
in FQL.
Method | Description |
---|---|
Delete a Token. |
|
Verify a Token. |
|
Replace a Token. |
|
Update a Token. |
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!