Browse Source

Fix Cardlife auth JSON type bug

master
NGnius (Graham) 3 years ago
parent
commit
c7d2db3a4a
3 changed files with 8 additions and 4 deletions
  1. +1
    -1
      Cargo.toml
  2. +6
    -2
      src/cardlife/live.rs
  3. +1
    -1
      src/cardlife/live_json.rs

+ 1
- 1
Cargo.toml View File

@@ -1,6 +1,6 @@
[package]
name = "libfj"
version = "0.5.2"
version = "0.5.3"
authors = ["NGnius (Graham) <ngniusness@gmail.com>"]
edition = "2018"
description = "An unofficial collection of APIs used in FreeJam games and mods"


+ 6
- 2
src/cardlife/live.rs View File

@@ -37,22 +37,26 @@ impl LiveAPI {
pub async fn authenticate_email(&mut self, email: &str, password: &str) -> Result<AuthenticationInfo, Error> {
let url = Url::parse(AUTHENTICATION_DOMAIN)
.unwrap()
.join("/api/auth/authenticate")
.join("api/auth/authenticate")
.unwrap();
let payload = AuthenticationPayload {
email_address: email.to_string(),
password: password.to_string()
};
let result = self.client.post(url)
let result = self.client.post(url.clone())
.json(&payload)
.send().await;
if let Ok(response) = result {
//println!("Resp: {}", response.text().await.unwrap());
let res = response.json::<AuthenticationInfo>().await;
if let Ok(auth) = &res {
self.auth = Some(auth.clone());
}
return res;
}
/*let result = self.client.post(url)
.json(&payload)
.send().await;*/
Err(result.err().unwrap())
}


+ 1
- 1
src/cardlife/live_json.rs View File

@@ -22,7 +22,7 @@ pub struct AuthenticationInfo {
pub display_name: String,
/// Account purchases (???)
#[serde(rename = "Purchases")]
purchases: Vec<String>, // ???
purchases: Vec<usize>, // ???
/// Account flags (dev, admin, etc.???)
#[serde(rename = "Flags")]
flags: Vec<String>, // ???


Loading…
Cancel
Save