Authentication
This commit is contained in:
@@ -13,11 +13,9 @@ struct AuthApiRes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn auth(_server: &Arc<Server>, client: &mut Client, token: &str) -> crate::Result<String> {
|
pub fn auth(_server: &Arc<Server>, client: &mut Client, token: &str) -> crate::Result<String> {
|
||||||
let mut res = ureq::get(format!(
|
let mut res = ureq::get(format!("https://vxchat.netlify.app/api/auth?token={token}"))
|
||||||
"http://localhost:3000/api/auth?intents=server&token={token}"
|
.call()
|
||||||
))
|
.context("Failed to authenticate")?;
|
||||||
.call()
|
|
||||||
.context("Failed to authenticate")?;
|
|
||||||
let api_res: AuthApiRes = serde_json::from_str(&res.body_mut().read_to_string()?)?;
|
let api_res: AuthApiRes = serde_json::from_str(&res.body_mut().read_to_string()?)?;
|
||||||
client.set_uuid(&api_res.user_id);
|
client.set_uuid(&api_res.user_id);
|
||||||
LOGGER.info(format!("{} successfully authenticated", api_res.user_id));
|
LOGGER.info(format!("{} successfully authenticated", api_res.user_id));
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ pub mod handshake {
|
|||||||
if !request_line.starts_with("GET") {
|
if !request_line.starts_with("GET") {
|
||||||
return Err(std::io::Error::new(
|
return Err(std::io::Error::new(
|
||||||
std::io::ErrorKind::InvalidData,
|
std::io::ErrorKind::InvalidData,
|
||||||
"Invalid HTTP method",
|
format!("Invalid HTTP method: {request_line}"),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user