Private
Public Access
1
0

snoozer: fix auth

This commit is contained in:
2025-08-29 23:08:37 -06:00
parent 54f7f3a4db
commit 8fcc7609b9

View File

@@ -7,6 +7,7 @@ use kordophone::{
APIInterface, APIInterface,
}; };
use kordophone::api::http_client::Credentials; use kordophone::api::http_client::Credentials;
use kordophone::api::AuthenticationStore;
use futures_util::StreamExt; use futures_util::StreamExt;
use hyper::Uri; use hyper::Uri;
@@ -49,9 +50,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let auth_store = InMemoryAuthenticationStore::new(Some(credentials.clone())); let auth_store = InMemoryAuthenticationStore::new(Some(credentials.clone()));
let mut client = HTTPAPIClient::new(server_url, auth_store); let mut client = HTTPAPIClient::new(server_url, auth_store);
// Authenticate first // Authenticate first (and set token manually in case the client doesn't)
let _token = client.authenticate(credentials).await?; let token = client.authenticate(credentials).await?;
println!("Authenticated successfully"); client.auth_store.set_token(token.to_string()).await;
println!("Authenticated successfully: {:?}", token);
// Open event socket // Open event socket
let event_socket = client.open_event_socket(None).await?; let event_socket = client.open_event_socket(None).await?;