.SignIn()
Signs in to a root, namespace, database or scope user.
Method Syntax
await db.SignIn(credentials)
Arguments
| Arguments | Description |
|---|
credentials required | Variables used in a signin query. |
cancellationToken optional | The cancellationToken enables graceful cancellation of asynchronous operations. |
Example usage
await db.SignIn(new RootAuth { Username = "root", Password = "secret" });
await db.SignIn(
new NamespaceAuth
{
Namespace = "test",
Username = "johndoe",
Password = "password123"
}
);
await db.SignIn(
new DatabaseAuth
{
Namespace = "test",
Database = "test",
Username = "johndoe",
Password = "password123"
}
);
var authParams = new AuthParams
{
Namespace = "test",
Database = "test",
Access = "user",
Email = "info@surrealdb.com",
Password = "123456"
};
Jwt jwt = await db.SignIn(authParams);
public class AuthParams : ScopeAuth
{
public string? Username { get; set; }
public string? Email { get; set; }
public string? Password { get; set; }
}
var authParams = new AuthParams
{
Namespace = "test",
Database = "test",
Scope = "user",
Email = "info@surrealdb.com",
Password = "123456"
};
Jwt jwt = await db.SignIn(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.