mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-05-08 12:34:43 +02:00
Refactor OAuth2 token exchange and refresh error handling
This commit is contained in:
parent
60924f6d8d
commit
8927a1fea6
3 changed files with 3 additions and 11 deletions
|
|
@ -452,11 +452,7 @@ async fn oauth2_callback(params: OAuth2CallbackParams) -> Result<Html<String>, E
|
|||
("client_secret", &client_secret),
|
||||
];
|
||||
|
||||
let response = match make_http_request(Method::POST, &token_url)?
|
||||
.form(&form_params)
|
||||
.send()
|
||||
.await
|
||||
{
|
||||
let response = match make_http_request(Method::POST, &token_url)?.form(&form_params).send().await {
|
||||
Ok(res) => res,
|
||||
Err(e) => err!(format!("OAuth2 Token Exchange Error: {e}")),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -898,7 +898,7 @@ make_config! {
|
|||
/// SMTP OAuth2 Refresh Token |> OAuth2 Refresh Token for obtaining new access tokens
|
||||
smtp_oauth2_refresh_token: Pass, true, option;
|
||||
/// SMTP OAuth2 Scopes |> Comma-separated list of OAuth2 scopes
|
||||
smtp_oauth2_scopes: String, true, def, "".to_string();
|
||||
smtp_oauth2_scopes: String, true, def, String::new();
|
||||
/// SMTP connection timeout |> Number of seconds when to stop trying to connect to the SMTP server
|
||||
smtp_timeout: u64, true, def, 15;
|
||||
/// Server name sent during HELO |> By default this value should be the machine's hostname, but might need to be changed in case it trips some anti-spam filters
|
||||
|
|
|
|||
|
|
@ -56,11 +56,7 @@ pub async fn refresh_oauth2_token() -> Result<OAuth2Token, Error> {
|
|||
("client_secret", &client_secret),
|
||||
];
|
||||
|
||||
let response = match make_http_request(reqwest::Method::POST, &token_url)?
|
||||
.form(&form_params)
|
||||
.send()
|
||||
.await
|
||||
{
|
||||
let response = match make_http_request(reqwest::Method::POST, &token_url)?.form(&form_params).send().await {
|
||||
Ok(res) => res,
|
||||
Err(e) => err!(format!("OAuth2 Token Refresh Error: {e}")),
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue