bitwarden_core/auth/api/request/
renew_token_request.rs1use serde::{Deserialize, Serialize};
2
3use crate::{
4 auth::{api::response::IdentityTokenResponse, login::LoginError},
5 client::ApiConfigurations,
6};
7
8#[derive(Serialize, Deserialize, Debug)]
9pub struct RenewTokenRequest {
10 grant_type: String,
11 refresh_token: String,
12 client_id: String,
13}
14
15impl RenewTokenRequest {
16 pub fn new(refresh_token: String, client_id: String) -> Self {
17 Self {
18 refresh_token,
19 client_id,
20 grant_type: "refresh_token".to_string(),
21 }
22 }
23
24 pub(crate) async fn send(
25 &self,
26 configurations: &ApiConfigurations,
27 ) -> Result<IdentityTokenResponse, LoginError> {
28 super::send_identity_connect_request(configurations, None, &self).await
29 }
30}