The .signin() method for the SurrealDB Rust SDK signs in to a specific access method.
Signs in to a specific access method for an already signed up record user.
Method Syntax
db.signin(credentials)
Arguments
Argument
Description
credentials
Variables used in a signin query.
Example usage
// Use the following statement to set up the access // // DEFINE ACCESS account ON DATABASE TYPE RECORD // SIGNUP ( CREATE user SET email = $email, pass = crypto::argon2::generate($pass) ) // SIGNIN ( SELECT * FROM user WHERE email = $email AND crypto::argon2::compare(pass, $pass) ) // DURATION FOR TOKEN 15m, FOR SESSION 12h // ;
// ⚠️: It is important to note that the token should be handled securely and protected from unauthorized access. letjwt=token.access.as_insecure_token(); dbg!(jwt); Ok(()) }