Skip to main content

smbcloud_model/
oauth.rs

1use {
2    serde::{Deserialize, Serialize},
3    tsync::tsync,
4};
5
6#[derive(Serialize, Deserialize, Debug, Clone)]
7#[tsync]
8pub struct TokenResponse {
9    pub access_token: String,
10    pub expires_in: i32,
11    pub refresh_token: Option<String>,
12    pub refresh_token_expires_in: Option<String>,
13    pub scope: String,
14    pub token_type: String,
15    /// OIDC identity token, present when the `openid` scope was granted
16    /// (smbCloud Auth AuthApp PKCE flow). Absent for plain OAuth responses.
17    #[serde(default, skip_serializing_if = "Option::is_none")]
18    pub id_token: Option<String>,
19}
20
21#[derive(Serialize, Deserialize, Debug, Clone)]
22#[tsync]
23pub struct OauthRedirect {
24    pub code: Option<String>,
25    pub scope: Option<String>,
26    pub authuser: i32,
27    pub prompt: String,
28}
29
30#[derive(Serialize, Deserialize, Debug, Clone)]
31#[tsync]
32pub struct UserInfo {
33    pub id: String,
34    pub email: String,
35    pub verified_email: bool,
36    pub name: String,
37    pub given_name: String,
38    pub family_name: String,
39    pub picture: String,
40}