Skip to main content

->signup()

Signs up to a specific authentication scope.

Method Syntax
$db->signup([
"namespace" => "test",
"database" => "db",
"scope" => "scope",
// ... other variables
]);

Arguments

ArgumentsDescription
namespaceREQUIRED

The namespace to sign up to

databaseREQUIRED

The database to sign up to

scopeREQUIRED1.x

The scope to sign up to. Also pass any variables used in the scope. Only supported in SurrealDB 1.x

accessREQUIRED >=2.x

The access to sign in to. Also pass any variables used in the access. Only supported from SurrealDB 2.x onwards

Example usage

$token = $db->signup([
"namespace" => "surrealdb",
"database" => "docs",
"scope" => "user",

// Also pass any properties required by the scope definition
"email" => "info@surrealdb.com",
"pass" => "123456",
]);

You can invalidate the authentication for the current connection using the invalidate() method.