client: actually do authentication properly
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
use kordophone::APIInterface;
|
||||
use kordophone::api::http_client::HTTPAPIClient;
|
||||
use kordophone::api::http_client::Credentials;
|
||||
use kordophone::api::InMemoryTokenStore;
|
||||
use kordophone::api::InMemoryAuthenticationStore;
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::Subcommand;
|
||||
use crate::printers::{ConversationPrinter, MessagePrinter};
|
||||
|
||||
pub fn make_api_client_from_env() -> HTTPAPIClient<InMemoryTokenStore> {
|
||||
pub fn make_api_client_from_env() -> HTTPAPIClient<InMemoryAuthenticationStore> {
|
||||
dotenv::dotenv().ok();
|
||||
|
||||
// read from env
|
||||
@@ -22,7 +22,7 @@ pub fn make_api_client_from_env() -> HTTPAPIClient<InMemoryTokenStore> {
|
||||
.expect("KORDOPHONE_PASSWORD must be set"),
|
||||
};
|
||||
|
||||
HTTPAPIClient::new(base_url.parse().unwrap(), credentials.into(), InMemoryTokenStore::new())
|
||||
HTTPAPIClient::new(base_url.parse().unwrap(), InMemoryAuthenticationStore::new(Some(credentials)))
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
@@ -51,7 +51,7 @@ impl Commands {
|
||||
}
|
||||
|
||||
struct ClientCli {
|
||||
api: HTTPAPIClient<InMemoryTokenStore>,
|
||||
api: HTTPAPIClient<InMemoryAuthenticationStore>,
|
||||
}
|
||||
|
||||
impl ClientCli {
|
||||
|
||||
Reference in New Issue
Block a user