pub struct Account {Show 13 fields
pub id: Id,
pub user_id: Id,
pub provider_id: String,
pub account_id: String,
pub password_hash: Option<String>,
pub access_token: Option<Vec<u8>>,
pub refresh_token: Option<Vec<u8>>,
pub id_token: Option<String>,
pub access_token_expires_at: Option<OffsetDateTime>,
pub refresh_token_expires_at: Option<OffsetDateTime>,
pub scope: Option<String>,
pub created_at: OffsetDateTime,
pub updated_at: OffsetDateTime,
}Expand description
A way to sign in: provider_id = "credential" holds the password hash; OAuth providers
hold their tokens, encrypted unless
store_oauth_tokens_in_plaintext is on.
Read them with Account::read_access_token and Account::read_refresh_token.
Fields§
§id: Id§user_id: Id§provider_id: String§account_id: String§password_hash: Option<String>§access_token: Option<Vec<u8>>As stored: Keys::encrypted, or the token’s bytes (see Account::read_access_token).
refresh_token: Option<Vec<u8>>As stored, like access_token.
id_token: Option<String>§access_token_expires_at: Option<OffsetDateTime>§refresh_token_expires_at: Option<OffsetDateTime>§scope: Option<String>§created_at: OffsetDateTime§updated_at: OffsetDateTimeImplementations§
Source§impl Account
impl Account
pub const CREDENTIAL: &'static str = "credential"
pub const ID: Col<Account, Id>
pub const USER_ID: Col<Account, Id>
pub const PROVIDER_ID: Col<Account, String>
pub const ACCOUNT_ID: Col<Account, String>
pub const PASSWORD_HASH: Col<Account, Option<String>>
pub const ACCESS_TOKEN: Col<Account, Option<Vec<u8>>>
pub const REFRESH_TOKEN: Col<Account, Option<Vec<u8>>>
pub const ID_TOKEN: Col<Account, Option<String>>
pub const ACCESS_TOKEN_EXPIRES_AT: Col<Account, Option<OffsetDateTime>>
pub const REFRESH_TOKEN_EXPIRES_AT: Col<Account, Option<OffsetDateTime>>
pub const SCOPE: Col<Account, Option<String>>
Sourcepub fn read_access_token(&self, keys: &Keys) -> Option<String>
pub fn read_access_token(&self, keys: &Keys) -> Option<String>
The provider’s access token, however the row stores it: encrypted by fastauth (as
bytes, or as hex in a text column), or as plain text, written by fastauth with
store_oauth_tokens_in_plaintext or
by a Better Auth app on the same database. None when the row has none, or holds
bytes that are neither.
A value counts as fastauth’s only when one of keys’ secrets decrypts it, so keep a
retired secret in .secrets(..) while rows encrypted under it remain: without it, such
a row in a text column reads as its hex.
Sourcepub fn read_refresh_token(&self, keys: &Keys) -> Option<String>
pub fn read_refresh_token(&self, keys: &Keys) -> Option<String>
The provider’s refresh token, read like Account::read_access_token.