supabase_auth_redux/models/token.rs
1use serde::{Deserialize, Serialize};
2
3use crate::models::user::UserSchema;
4
5/// Response containing authentication tokens and user information
6///
7/// This is returned after successful authentication operations like signin or signup.
8#[derive(Debug, Default, Deserialize, Serialize, Eq, PartialEq)]
9#[serde(default)]
10pub struct TokenResponse {
11 /// JWT access token for API authentication
12 pub access_token: String,
13 /// Token type (typically "bearer")
14 pub token_type: String,
15 /// Token validity duration in seconds
16 pub expires_in: u64,
17 /// Unix timestamp when the token expires
18 pub expires_at: u64,
19 /// Refresh token for obtaining new access tokens
20 pub refresh_token: String,
21 /// User information associated with the token
22 pub user: Option<UserSchema>,
23 /// OAuth provider token (if using third-party auth)
24 pub provider_token: String,
25 /// OAuth provider refresh token (if using third-party auth)
26 pub provider_refresh_token: String,
27 /// Weak password warning information
28 pub weak_password: Option<WeakPasswordError>,
29}
30
31/// Error information returned when a password is considered weak
32#[derive(Debug, Default, Deserialize, Serialize, Eq, PartialEq)]
33#[serde(default)]
34pub struct WeakPasswordError {
35 /// Description of why the password is weak
36 pub message: String,
37 /// List of specific reasons the password was rejected
38 pub reasons: Vec<String>,
39}