use crate::cli::args::AuthArgs;
use crate::cli::auth_params::AuthParams;
use crate::cli::output::print_header;
use crate::config::cli_config::Profile;
use crate::services::authentication::authenticator::execute_flow;
use crate::services::authentication::pkce::AuthorizationCodeFlow;
use miette::Result;
pub async fn run(profile: Profile, args: AuthArgs, port: u16) -> Result<()> {
print_header("OAuth2 Token Generator (PKCE)");
let auth = AuthParams::new(&profile, args, "openid profile email")?;
let flow = AuthorizationCodeFlow {
provider: auth.provider,
client_id: auth.client_id,
scopes: auth.scopes,
port,
};
execute_flow(&flow).await?;
Ok(())
}