This commit is contained in:
Untone 2023-12-13 20:41:50 +03:00
parent 88f8f951ca
commit 354bc54cad

View File

@ -75,7 +75,7 @@ pub async fn get_id_by_token(token: &str) -> Result<i32, Box<dyn Error>> {
variables.insert("token_type".to_string(), "access_token".to_string());
let gql = json!({
"query": format!("query {}($params: ValidateJWTTokenInput) {{ {}(params: $params) {{ is_valid claims }} }}", operation, query_name),
"query": format!("query {}($params: ValidateJWTTokenInput!) {{ {}(params: $params) {{ is_valid claims }} }}", operation, query_name),
"operationName": operation,
"variables": variables
});
@ -90,7 +90,7 @@ pub async fn get_id_by_token(token: &str) -> Result<i32, Box<dyn Error>> {
let response_text = response.text().await?;
println!("Server Response: {}", response_text);
/*
if response.status().is_success() {
let r: HashMap<String, serde_json::Value> = response.json().await?;
let user_id = r
@ -120,7 +120,7 @@ pub async fn get_id_by_token(token: &str) -> Result<i32, Box<dyn Error>> {
format!("Request failed with status: {}", response.status()),
)))
}
*/
Err(Box::new(std::io::Error::new(
std::io::ErrorKind::Other,
"No user ID found in the response",