• Start

Languages

/

Mojo

/

Methods

signin

The signin() method for the SurrealDB Mojo SDK signs in to the database with credentials.

Signs in to the database with CBOR-encoded credentials. On success, the returned token is stored on the client for subsequent requests.

Method Syntax

client.signin(credentials_cbor, session)
ArgumentDescription
credentials_cborThe credentials, CBOR-encoded as a map, as a List[UInt8].
sessionAn optional session id.
from surrealdb import CborCodec
from std.collections import List

var codec = CborCodec()
var pairs = List[Tuple[String, List[UInt8]]]()
pairs.append(Tuple(String("user"), codec.encode_text("root")))
pairs.append(Tuple(String("pass"), codec.encode_text("root")))

var resp = client.signin(codec.encode_map(pairs))

Was this page helpful?