You've already forked AstralRinth
forked from didirus/AstralRinth
Switch to official launcher auth (#1118)
* Switch to official launcher auth * add debug info * Fix build
This commit is contained in:
@@ -14,15 +14,20 @@ use theseus::profile::create::profile_create;
|
||||
// 3) call the authenticate_await_complete_flow() function to get the credentials (like you would in the frontend)
|
||||
pub async fn authenticate_run() -> theseus::Result<Credentials> {
|
||||
println!("A browser window will now open, follow the login flow there.");
|
||||
let login = auth::authenticate_begin_flow().await?;
|
||||
let login = minecraft_auth::begin_login().await?;
|
||||
|
||||
println!("URL {}", login.verification_uri.as_str());
|
||||
println!("Code {}", login.user_code.as_str());
|
||||
webbrowser::open(login.verification_uri.as_str())
|
||||
.map_err(|e| IOError::with_path(e, login.verification_uri.as_str()))?;
|
||||
println!("URL {}", login.redirect_uri.as_str());
|
||||
webbrowser::open(login.redirect_uri.as_str())?;
|
||||
|
||||
let credentials = auth::authenticate_await_complete_flow().await?;
|
||||
State::sync().await?;
|
||||
println!("Please enter URL code: ");
|
||||
let mut input = String::new();
|
||||
std::io::stdin()
|
||||
.read_line(&mut input)
|
||||
.expect("error: unable to read user input");
|
||||
|
||||
println!("You entered: {}", input.trim());
|
||||
|
||||
let credentials = minecraft_auth::finish_login(&input, login).await?;
|
||||
|
||||
println!("Logged in user {}.", credentials.username);
|
||||
Ok(credentials)
|
||||
@@ -38,6 +43,11 @@ async fn main() -> theseus::Result<()> {
|
||||
let st = State::get().await?;
|
||||
//State::update();
|
||||
|
||||
if minecraft_auth::users().await?.is_empty() {
|
||||
println!("No users found, authenticating.");
|
||||
authenticate_run().await?; // could take credentials from here direct, but also deposited in state users
|
||||
}
|
||||
|
||||
// Autodetect java globals
|
||||
let jres = jre::get_all_jre().await?;
|
||||
let java_8 = jre::find_filtered_jres("1.8", jres.clone(), false).await?;
|
||||
@@ -91,12 +101,6 @@ async fn main() -> theseus::Result<()> {
|
||||
|
||||
State::sync().await?;
|
||||
|
||||
// Attempt to run game
|
||||
if auth::users().await?.is_empty() {
|
||||
println!("No users found, authenticating.");
|
||||
authenticate_run().await?; // could take credentials from here direct, but also deposited in state users
|
||||
}
|
||||
|
||||
println!("running");
|
||||
// Run a profile, running minecraft and store the RwLock to the process
|
||||
let proc_lock = profile::run(&profile_path).await?;
|
||||
|
||||
Reference in New Issue
Block a user