🐛 fix: fix mc auth

This commit is contained in:
Pauline 2024-07-23 18:29:26 +02:00
parent f12eaf5bd8
commit 0dcc7083a9
No known key found for this signature in database
GPG key ID: 722BB181973296AE
2 changed files with 12 additions and 12 deletions

View file

@ -508,7 +508,7 @@ async fn oauth_token(
query.insert("scope", SCOPES);
let res = auth_retry(|| {
crate::utils::http::REQWEST_CLIENT
.post(REDIRECT_URL)
.post("https://login.live.com/oauth20_token.srf")
.header("Accept", "application/json")
.form(&query)
.send()
@ -555,7 +555,7 @@ async fn oauth_refresh(
query.insert("scope", SCOPES);
let res = auth_retry(|| {
crate::utils::http::REQWEST_CLIENT
.post(REDIRECT_URL)
.post("https://login.live.com/oauth20_token.srf")
.header("Accept", "application/json")
.form(&query)
.send()
@ -657,13 +657,13 @@ async fn xsts_authorize(
"/xsts/authorize",
json!({
"RelyingParty": "rp://api.minecraftservices.com/",
"TokenType": "JWT",
"Properties": {
"SandboxId": "RETAIL",
"UserTokens": [authorize.user_token.token],
"DeviceTokens": device_token,
"TitleToken": authorize.title_token.token,
},
"TokenType": "JWT",
"Properties": {
"SandboxId": "RETAIL",
"UserTokens": [authorize.user_token.token],
"DeviceToken": device_token,
"TitleToken": authorize.title_token.token,
},
}),
key,
MinecraftAuthStep::XstsAuthorize,
@ -739,7 +739,7 @@ struct MinecraftProfile {
async fn minecraft_profile(token: &str) -> Result<MinecraftProfile, MinecraftAuthError> {
let res = auth_retry(|| {
crate::utils::http::REQWEST_CLIENT
.get("https//api.minecraftservices.com/minecraft/profile")
.get("https://api.minecraftservices.com/minecraft/profile")
.header("Accept", "application/json")
.bearer_auth(token)
.send()

View file

@ -4,6 +4,7 @@
)]
use onelauncher::prelude::*;
use onelauncher::cluster::create::create_cluster;
pub async fn authenticate_mc() -> onelauncher::Result<MinecraftCredentials> {
println!("a browser will open, follow login flow");
@ -47,7 +48,6 @@ async fn main() -> onelauncher::Result<()> {
state.settings.write().await.max_async_fetches = 100;
state.settings.write().await.init_hooks.post =
Some("echo this should run after minecraft as a global hook".to_string());
// test changing fetch settings and resetting the semaphore
state.reset_fetch_semaphore().await;
println!("clearing clusters");
@ -63,7 +63,7 @@ async fn main() -> onelauncher::Result<()> {
let loader = Loader::Vanilla;
let loader_version = "stable".to_string();
let cluster = create::create_cluster(
let cluster = create_cluster(
name.clone(),
game,
loader,