Login
Login( identity, param_object )
Login( identity, param_object )
Login( identity, param_object )
Login( identity, param_object )
login( identity, param_object )
Login( identity, param_object )
Description
The Login
function creates an authentication token for the
provided identity
using the password
provided in the param_object
.
The identity
field can be a Reference for the identity document that
should be authenticated, or a Set of
References (where only the first Reference in the Set is
authenticated).
If the identity document does not exist, or the provided password is
incorrect, Login
returns an error.
The authentication token secret for an authentication token can be used
to connect to Fauna and execute queries in the database that has the
identity
. The permissions granted to the authentication token can be
defined using Attribute-based access control
(ABAC).
If the identity
is not a member of at least one ABAC role, it has no
privileges to read or write documents except its own identity document.
Parameters
Parameter | Type | Definition and Requirements |
---|---|---|
|
||
|
The |
param_object
Field Name | Field Type | Definition and Requirements |
---|---|---|
|
Optional - a document storing metadata about the token to be created. |
|
|
The password to authenticate |
|
|
Optional - A timestamp that indicates the time-to-live for a document,
which is when the document is removed from the collection and can’t be
queried. The document history can continue to be accessed using
the |
Examples
ObjectV(ref: RefV(id = "280491620815602176", collection = RefV(id = "tokens")),ts: LongV(1603756504750000),instance: RefV(id = "181388642114077184", collection = RefV(id = "characters", collection = RefV(id = "collections"))),secret: StringV(fnED5IGknTACAAPkgaNqIAIAx6peH_1tJ7X82fJ7bcOF6exEWYw))
map[instance:{181388642114077184 0xc00008e3f0 0xc00008e3f0 <nil>} ref:{280481898848846336 0xc00008e240 0xc00008e240 <nil>} secret:fnED5HjNCtACAAPkeMygwAIA1rfQDqKRQAnHrDBoN1a_DgsbVMw ts:1603747233160000]
{ref: ref(id = "269701642908074496", collection = ref(id = "tokens")), ts: 1593466379950000, instance: ref(id = "181388642114077184", collection = ref(id = "characters", collection = ref(id = "collections"))), secret: "fnEDviw3HOACAAO-LDL9UAIAe6cFd6PJDjOcXLSnrSH2s6K97Fk"}
{
ref: Ref(Tokens(), "268283157930836480"),
ts: 1592113607250000,
instance: Ref(Collection("characters"), "181388642114077184"),
secret: 'fnEDuSIcV7ACAAO5IhwXkAIAMQbrsrZaHs1cUWnligxyD5kUAPE'
}
{'ref': Ref(id=269168498780930560, collection=Ref(id=tokens)), 'ts': 1592957934080000, 'instance': Ref(id=181388642114077184, collection=Ref(id=characters, collection=Ref(id=collections))), 'secret': 'fnEDvEdS0pACAAO8R1KZUAIAswCZXMn3gnH_93FC7t_-eRUlqCU'}
{
ref: Ref(Tokens(), "302044012369412608"),
ts: 1624310467030000,
instance: Ref(Collection("characters"), "181388642114077184"),
secret: 'fnEEMRNtz9ACAAQxE20rQAYAdf5rxVCUGicwNLCuiIB8CjHCqME'
}
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!