Skip to main content

delete_all_user_tokens

Function delete_all_user_tokens 

Source
pub async fn delete_all_user_tokens(
    db: &DB,
    user_id: &str,
) -> Result<(), Box<dyn Error + Send + Sync>>
Expand description

Deletes all refresh tokens associated with a user from the database.

§Arguments

  • db - A reference to the database connection.
  • user_id - The ID of the user whose tokens should be deleted.

§Returns

  • Ok(()) if the tokens were successfully deleted.
  • Err if there was an error during the database operation.

§Example

use crate::db::DB;
use crate::db::queries::tokens::delete_all_user_tokens;
let db = DB::new("localhost:8529", "my_database").await.unwrap();
delete_all_user_tokens(&db, "user123").await.unwrap();