feat: initial work on refresh tokens

This commit is contained in:
Zomatree
2025-07-05 00:58:57 +01:00
parent 660e646b2b
commit ef65223c89
15 changed files with 210 additions and 79 deletions

View File

@@ -1,5 +1,7 @@
use iso8601_timestamp::Timestamp;
use crate::v0::PublicBot;
auto_derived!(
/// Unique id of the user and bot
pub struct AuthorizedBotId {
@@ -24,4 +26,9 @@ auto_derived!(
/// Scopes the bot has access to
pub scope: String
}
pub struct AuthorizedBotsResponse {
pub public_bot: PublicBot,
pub authorized_bot: AuthorizedBot
}
);

View File

@@ -37,6 +37,9 @@ auto_derived!(
#[cfg_attr(feature = "rocket", field(value = "implicit"))]
#[cfg_attr(feature = "serde", serde(rename = "implicit"))]
Implicit,
#[cfg_attr(feature = "rocket", field(value = "refresh_token"))]
#[cfg_attr(feature = "serde", serde(rename = "refresh_token"))]
RefreshToken
}
#[derive(Copy)]
@@ -66,12 +69,17 @@ auto_derived!(
pub client_id: String,
pub client_secret: Option<String>,
pub code: String,
/// Authorization code
pub code: Option<String>,
// Refresh token to generate new access token
pub refresh_token: Option<String>,
pub code_verifier: Option<String>,
}
pub struct OAuth2TokenExchangeResponse {
pub access_token: String,
pub refresh_token: Option<String>,
pub token_type: String,
pub scope: String,
}