summaryrefslogtreecommitdiffstats
path: root/crates/auth
diff options
context:
space:
mode:
Diffstat (limited to 'crates/auth')
-rw-r--r--crates/auth/auth.toml6
-rw-r--r--crates/auth/src/main.rs6
-rw-r--r--crates/auth/src/server/routes/authorised.rs5
3 files changed, 9 insertions, 8 deletions
diff --git a/crates/auth/auth.toml b/crates/auth/auth.toml
index 17a696f..4c1c0ca 100644
--- a/crates/auth/auth.toml
+++ b/crates/auth/auth.toml
@@ -2,10 +2,16 @@
env = "development"
port = 1304
+[nats]
+hosts = ["nats://localhost:4222"]
+
[misc.oauth]
session-lifespan = 3600 # seconds
jwt-encoding-key = "secret"
+[misc.nats]
+subject = "users"
+
[misc.oauth.discord]
# query param for provider
redirect-url = "http://127.0.0.1:1304/auth/authorised?provider=discord"
diff --git a/crates/auth/src/main.rs b/crates/auth/src/main.rs
index 72f991f..53a18dd 100644
--- a/crates/auth/src/main.rs
+++ b/crates/auth/src/main.rs
@@ -16,11 +16,7 @@ use tonic::service::Routes;
use tower::{make::Shared, steer::Steer};
use tracing::{info, trace};
-use crate::{
- error::AppError,
- server::{grpc::interceptor::MyInterceptor, routes::authorised::AuthRequest},
- state::AppState,
-};
+use crate::{error::AppError, server::grpc::interceptor::MyInterceptor, state::AppState};
/// auth-service
#[derive(Parser, Debug)]
diff --git a/crates/auth/src/server/routes/authorised.rs b/crates/auth/src/server/routes/authorised.rs
index 50fcfc8..83f73cf 100644
--- a/crates/auth/src/server/routes/authorised.rs
+++ b/crates/auth/src/server/routes/authorised.rs
@@ -91,6 +91,8 @@ pub async fn login_authorised(
.await
.context("failed to deserialise response as JSON")?;
+ dbg!(&user_data);
+
let user_data: User = serde_json::from_value(user_data)?;
if !user_data.verified {
@@ -122,10 +124,8 @@ pub async fn login_authorised(
.await?;
let user = if let Some(user) = user {
- println!("some");
user
} else {
- println!("none");
let uuid = uuid::Uuid::now_v7();
let user = sqlx::query_as!(
DbUser,
@@ -170,7 +170,6 @@ pub async fn login_authorised(
let claims = Claims {
sub: user.id,
- // Mandatory expiry time as UTC timestamp
exp: exp.unix_timestamp(),
iss: "sellershut".to_owned(),
sid: session_id.to_string(),