SurrealDB Docs Logo

Enter a search query

.signup()

Signs up to a specific authentication scope.

Method Syntax
async db.signup({`{ namespace, database, [ scope | access ], [...] }`})

Arguments

ArgumentsDescription
namespace required

The namespace to sign up to

database required

The database to sign up to

scope required

1.x

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

access required

>=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

// With Record Access const token = await db.signup({ namespace: 'surrealdb', database: 'docs', access: 'user', // Also pass any properties required by the scope definition variables: { email: 'info@surrealdb.com', pass: '123456', }, }); // With Scopes const token = await 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. Learn more about handling authentication.

On this page

© SurrealDB GitHub Discord Community Cloud Features Releases Install