mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 00:46:30 +03:00
first pass at resolving CR
This commit is contained in:
@@ -75,8 +75,6 @@ pub async fn dc_get_oauth2_url(
|
||||
}
|
||||
}
|
||||
|
||||
// The following function may block due http-requests;
|
||||
// must not be called from the main thread or by the ui!
|
||||
pub async fn dc_get_oauth2_access_token(
|
||||
context: &Context,
|
||||
addr: impl AsRef<str>,
|
||||
@@ -84,9 +82,7 @@ pub async fn dc_get_oauth2_access_token(
|
||||
regenerate: bool,
|
||||
) -> Option<String> {
|
||||
if let Some(oauth2) = Oauth2::from_address(addr) {
|
||||
// TODO: FIXME
|
||||
// let lock = context.oauth2_critical.clone();
|
||||
// let _l = lock.lock().await;
|
||||
let lock = context.oauth2_mutex.lock().await;
|
||||
|
||||
// read generated token
|
||||
if !regenerate && !is_expired(context).await {
|
||||
@@ -243,6 +239,8 @@ pub async fn dc_get_oauth2_access_token(
|
||||
warn!(context, "Failed to find OAuth2 access token");
|
||||
}
|
||||
|
||||
drop(lock);
|
||||
|
||||
response.access_token
|
||||
} else {
|
||||
warn!(context, "Internal OAuth2 error: 2");
|
||||
|
||||
Reference in New Issue
Block a user