Login

Login( identity, password )
Login( identity, password )
Login( identity, password )
Login( identity, password )
login( identity, password )
login( identity, password )
Login( identity, password )
Login( identity, password )

Description

The Login function creates an authentication token for the provided Ref, or Set of Refs.

Parameters

Argument Type Definition and Requirements

identity

Ref or Set

The identity or identities to authenticate.

password

String

The password to use for authentication.

Returns

When authentication is successful, an object containing the authenticated Ref(s) is returned. When authentication fails, an error is returned.

Examples

curl https://db.fauna.com/ \
    -u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
    -d '{
          "login": { "@ref": "classes/characters/181388642114077184" },
          "params": { "object": { "password": "abracadabra" } }
        }'
client.Query(
  Login(
    Ref("classes/characters/181388642114077184"),
    Obj("password", "abracadabra")));
System.out.println(
       client.query(
           Login(
             Ref(Class("characters"), Value(181388642114077184L)),
             Obj("password", Value("abracadabra")))
       ).get());
result, _ := client.Query(
    f.Login(
        f.RefClass(f.Class("characters"), "181388642114077184"),
        f.Obj{"password": "abracadabra"},
    ),
)

fmt.Println(result)
client.query(
  Login(
    Ref("classes/characters/181388642114077184"),
    Obj("password" -> "abracadabra")))
client.query(
  q.login(
    Ref("classes/characters/181388642114077184"),
    {"password": "abracadabra"}
  ))
$client.query do
  login ref('classes/characters/181388642114077184'),
        password: 'abracadabra'
end
client.query(
    Login(
        for: Ref("classes/characters/181388642114077184"),
        Obj("password" => "abracadabra")
    )
)
client.query(
  q.Login(q.Ref(q.Class("characters"), "181388642114077184"), { password: "abracadabra" }))
.then((ret) => console.log(ret))
HTTP/1.1 201 Created
{
  "resource": {
    "ref": { "@ref": "tokens/181388643175236096" },
    "class": { "@ref": "tokens" },
    "ts": 1509244540264619,
    "instance": { "@ref": "classes/characters/181388642114077184" },
    "secret": "fnEChGwCisACAAKEbAFuUAIAwIxOcffRgoJm7EgUt_zlmiPOze4"
  }
}
{
  "ref": { "@ref": "tokens/181388643175236096" },
  "class": { "@ref": "tokens" },
  "ts": 1509244540264619,
  "instance": { "@ref": "classes/characters/181388642114077184" },
  "secret": "fnEChGwCisACAAKEbAFuUAIAwIxOcffRgoJm7EgUt_zlmiPOze4"
}
{
  ref: ref(id = "210072853209416192", class = ref(id = "tokens")),
  ts: 1536599934671870,
  instance: ref(id = "181388642114077184", class = ref(id = "characters", class = ref(id = "classes"))),
  secret: "fnEC6lQloIACAALqVCVT8AIAtHiABBu-jZoAKERviRRl5bjZNBQ"
}
map[ref:{181388643175236096 0xc4202b3440 <nil>} ts:1509244540264619 instance:{181388642114077184 0xc4202b36c0 <nil>} secret:fnEChGwCisACAAKEbAFuUAIAwIxOcffRgoJm7EgUt_zlmiPOze4]
{
  "ref": { "@ref": "tokens/181388643175236096" },
  "class": { "@ref": "tokens" },
  "ts": 1509244540264619,
  "instance": { "@ref": "classes/characters/181388642114077184" },
  "secret": "fnEChGwCisACAAKEbAFuUAIAwIxOcffRgoJm7EgUt_zlmiPOze4"
}
{
  "ref": { "@ref": "tokens/181388643175236096" },
  "class": { "@ref": "tokens" },
  "ts": 1509244540264619,
  "instance": { "@ref": "classes/characters/181388642114077184" },
  "secret": "fnEChGwCisACAAKEbAFuUAIAwIxOcffRgoJm7EgUt_zlmiPOze4"
}
{
  "ref": { "@ref": "tokens/181388643175236096" },
  "class": { "@ref": "tokens" },
  "ts": 1509244540264619,
  "instance": { "@ref": "classes/characters/181388642114077184" },
  "secret": "fnEChGwCisACAAKEbAFuUAIAwIxOcffRgoJm7EgUt_zlmiPOze4"
}
{
  "ref": { "@ref": "tokens/181388643175236096" },
  "class": { "@ref": "tokens" },
  "ts": 1509244540264619,
  "instance": { "@ref": "classes/characters/181388642114077184" },
  "secret": "fnEChGwCisACAAKEbAFuUAIAwIxOcffRgoJm7EgUt_zlmiPOze4"
}
{ ref: Ref(id=181388643175236096, class=Ref(id=tokens)),
  ts: 1527279532953934,
  instance:
   Ref(id=181388642114077184, class=Ref(id=characters, class=Ref(id=classes))),
  secret: 'fnECx5uE8OACAQLCZP7uQAIBF3rvpXoJEzfIrNXEL21PUpib9AE' }