Skip to content

Commit 06f2865

Browse files
authored
add fields for refresh token and expiry timestamps (#477)
1 parent 2a3bfdb commit 06f2865

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/auth.rs

+9
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ pub struct OAuth {
100100
pub access_token: SecretString,
101101
pub token_type: String,
102102
pub scope: Vec<String>,
103+
pub expires_in: Option<usize>,
104+
pub refresh_token: Option<SecretString>,
105+
pub refresh_token_expires_in: Option<usize>,
103106
}
104107

105108
/// The wire format of the OAuth struct.
@@ -108,6 +111,9 @@ struct OAuthWire {
108111
access_token: String,
109112
token_type: String,
110113
scope: String,
114+
expires_in: Option<usize>,
115+
refresh_token: Option<String>,
116+
refresh_token_expires_in: Option<usize>,
111117
}
112118

113119
impl From<OAuthWire> for OAuth {
@@ -116,6 +122,9 @@ impl From<OAuthWire> for OAuth {
116122
access_token: SecretString::from(value.access_token),
117123
token_type: value.token_type,
118124
scope: value.scope.split(',').map(ToString::to_string).collect(),
125+
expires_in: value.expires_in,
126+
refresh_token: value.refresh_token.map(|t| SecretString::from(t)),
127+
refresh_token_expires_in: value.refresh_token_expires_in,
119128
}
120129
}
121130
}

0 commit comments

Comments
 (0)