mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-03 06:51:53 +01:00
cli: support refresh token in tunnel user login (#212106)
This commit is contained in:
@@ -480,6 +480,7 @@ impl Auth {
|
||||
&self,
|
||||
provider: Option<AuthProvider>,
|
||||
access_token: Option<String>,
|
||||
refresh_token: Option<String>,
|
||||
) -> Result<StoredCredential, AnyError> {
|
||||
let provider = match provider {
|
||||
Some(p) => p,
|
||||
@@ -490,8 +491,12 @@ impl Auth {
|
||||
Some(t) => StoredCredential {
|
||||
provider,
|
||||
access_token: t,
|
||||
refresh_token: None,
|
||||
expires_at: None,
|
||||
// if a refresh token is given, assume it's valid now but refresh it
|
||||
// soon in order to get the real expiry time.
|
||||
expires_at: refresh_token
|
||||
.as_ref()
|
||||
.map(|_| Utc::now() + chrono::Duration::minutes(5)),
|
||||
refresh_token,
|
||||
},
|
||||
None => self.do_device_code_flow_with_provider(provider).await?,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user