diff --git a/server-api/src/auth.rs b/server-api/src/auth.rs index 747a0bd..96ebf95 100644 --- a/server-api/src/auth.rs +++ b/server-api/src/auth.rs @@ -99,7 +99,7 @@ pub fn encrypt_secret(raw: &str) -> BcryptResult { fn jwt_from_serde(params: &serde_json::Value) -> Option<&str> { // gets the `token` from the parameters // option -> some(value) -> string - return params.get("token")?.as_str(); + return params.get("jwt")?.as_str(); } async fn valid_jwt(p: &Pool, token: &str) -> AuthReason { @@ -201,7 +201,7 @@ pub async fn login_get_jwt(p: &Pool, response: &mut hyper::Response &EncodingKey::from_base64_secret(HMAC_SECRET.as_ref()).expect("Couldn't encode from secret")) .expect("Could not encode JWT"); - match db::auth::add_jwt(p, encoded.as_ref()).await { + match db::auth::add_jwt(p, id, encoded.as_ref()).await { Ok(_) => { response.headers_mut().insert("Content-Type", HeaderValue::from_static("application/json"));