- add: login via token
- update: login request packet uses token login instead of user & pass
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use crate::auth::auth_service_client::AuthServiceClient;
|
||||
use crate::auth::{LoginRequest, LoginResponse};
|
||||
use crate::auth::{LoginRequest, LoginResponse, ValidateTokenRequest, ValidateTokenResponse};
|
||||
use tonic::transport::Channel;
|
||||
|
||||
pub struct AuthClient {
|
||||
@@ -21,4 +21,13 @@ impl AuthClient {
|
||||
let response = self.client.login(request).await?;
|
||||
Ok(response.into_inner())
|
||||
}
|
||||
|
||||
pub async fn login_token(&mut self, token: &str) -> Result<ValidateTokenResponse, Box<dyn std::error::Error + Send + Sync>> {
|
||||
let request = ValidateTokenRequest {
|
||||
token: token.to_string(),
|
||||
};
|
||||
|
||||
let response = self.client.validate_token(request).await?;
|
||||
Ok(response.into_inner())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user