.SignUp()
Signs up to a specific authentication scope / access method.
Method Syntaxawait db.SignUp(credentials)
Arguments | Description | ||
---|---|---|---|
credentials required | Credentials to sign up as a scoped user. | ||
cancellationToken optional | The cancellationToken enables graceful cancellation of asynchronous operations. |
// With Record Access var authParams = new AuthParams { Namespace = "test", Database = "test", Access = "user", // Also pass any properties required by the access definition Email = "info@surrealdb.com", Password = "123456" }; Jwt jwt = await db.SignUp(authParams); public class AuthParams : ScopeAuth { public string? Username { get; set; } public string? Email { get; set; } public string? Password { get; set; } }
// With Scopes var authParams = new AuthParams { Namespace = "test", Database = "test", Scope = "user", // Also pass any properties required by the scope definition Email = "info@surrealdb.com", Password = "123456" }; Jwt jwt = await db.SignUp(authParams); public class AuthParams : ScopeAuth { public string? Username { get; set; } public string? Email { get; set; } public string? Password { get; set; } }
You can invalidate the authentication for the current connection using the Invalidate()
method.