diff --git a/cli/src/auth.rs b/cli/src/auth.rs index 0214b335247ac..4ada6d22b1fb8 100644 --- a/cli/src/auth.rs +++ b/cli/src/auth.rs @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ use crate::{ - constants::{get_default_user_agent, PRODUCT_NAME_LONG}, + constants::{get_default_user_agent, IS_INTERACTIVE_CLI, PRODUCT_NAME_LONG}, debug, error, info, log, state::{LauncherPaths, PersistedState}, trace, @@ -37,7 +37,7 @@ struct DeviceCodeResponse { expires_in: i64, } -#[derive(Deserialize)] +#[derive(Deserialize, Debug)] struct AuthenticationResponse { access_token: String, refresh_token: Option, @@ -76,7 +76,7 @@ impl AuthProvider { pub fn code_uri(&self) -> &'static str { match self { AuthProvider::Microsoft => { - "https://login.microsoftonline.com/common/oauth2/v2.0/devicecode" + "https://login.microsoftonline.com/organizations/oauth2/v2.0/devicecode" } AuthProvider::Github => "https://github.com/login/device/code", } @@ -84,7 +84,7 @@ impl AuthProvider { pub fn grant_uri(&self) -> &'static str { match self { - AuthProvider::Microsoft => "https://login.microsoftonline.com/common/oauth2/v2.0/token", + AuthProvider::Microsoft => "https://login.microsoftonline.com/organizations/oauth2/v2.0/token", AuthProvider::Github => "https://github.com/login/oauth/access_token", } } @@ -670,7 +670,11 @@ impl Auth { } async fn prompt_for_provider(&self) -> Result { - if std::env::var("VSCODE_CLI_ALLOW_MS_AUTH").is_err() { + if !*IS_INTERACTIVE_CLI { + info!( + self.log, + "Using Github for authentication, pass the `--provider` option to change this." + ); return Ok(AuthProvider::Github); }