diff --git a/k8s/auth-service/values-prod.yaml b/k8s/auth-service/values-prod.yaml index 01d916bd2b..42e22201c3 100644 --- a/k8s/auth-service/values-prod.yaml +++ b/k8s/auth-service/values-prod.yaml @@ -6,7 +6,7 @@ app: replicaCount: 3 image: repository: eu.gcr.io/airqo-250220/airqo-auth-api - tag: prod-486fc5ca-1740492588 + tag: prod-533e06c0-1740550034 nameOverride: '' fullnameOverride: '' podAnnotations: {} diff --git a/k8s/auth-service/values-stage.yaml b/k8s/auth-service/values-stage.yaml index ee770d6443..def124b361 100644 --- a/k8s/auth-service/values-stage.yaml +++ b/k8s/auth-service/values-stage.yaml @@ -6,7 +6,7 @@ app: replicaCount: 2 image: repository: eu.gcr.io/airqo-250220/airqo-stage-auth-api - tag: stage-967ec6d2-1740492484 + tag: stage-c19b9d1b-1740578709 nameOverride: '' fullnameOverride: '' podAnnotations: {} diff --git a/k8s/data-mgt/values-prod.yaml b/k8s/data-mgt/values-prod.yaml index cfdae2ba5f..9c728866e0 100644 --- a/k8s/data-mgt/values-prod.yaml +++ b/k8s/data-mgt/values-prod.yaml @@ -6,7 +6,7 @@ app: replicaCount: 2 image: repository: eu.gcr.io/airqo-250220/airqo-data-mgt-api - tag: prod-486fc5ca-1740492588 + tag: prod-ce31cd3f-1740578785 nameOverride: '' fullnameOverride: '' podAnnotations: {} diff --git a/k8s/device-registry/values-prod.yaml b/k8s/device-registry/values-prod.yaml index 2c5d328a10..fe70b32a3c 100644 --- a/k8s/device-registry/values-prod.yaml +++ b/k8s/device-registry/values-prod.yaml @@ -6,7 +6,7 @@ app: replicaCount: 3 image: repository: eu.gcr.io/airqo-250220/airqo-device-registry-api - tag: prod-486fc5ca-1740492588 + tag: prod-ce31cd3f-1740578785 nameOverride: '' fullnameOverride: '' podAnnotations: {} diff --git a/k8s/predict/values-prod.yaml b/k8s/predict/values-prod.yaml index 88cc5ceaa5..cc9d12ed6f 100644 --- a/k8s/predict/values-prod.yaml +++ b/k8s/predict/values-prod.yaml @@ -7,7 +7,7 @@ images: predictJob: eu.gcr.io/airqo-250220/airqo-predict-job trainJob: eu.gcr.io/airqo-250220/airqo-train-job predictPlaces: eu.gcr.io/airqo-250220/airqo-predict-places-air-quality - tag: prod-486fc5ca-1740492588 + tag: prod-ce31cd3f-1740578785 api: name: airqo-prediction-api label: prediction-api diff --git a/k8s/spatial/values-prod.yaml b/k8s/spatial/values-prod.yaml index aafe253e24..ba934dfa5d 100644 --- a/k8s/spatial/values-prod.yaml +++ b/k8s/spatial/values-prod.yaml @@ -6,7 +6,7 @@ app: replicaCount: 3 image: repository: eu.gcr.io/airqo-250220/airqo-spatial-api - tag: prod-486fc5ca-1740492588 + tag: prod-ce31cd3f-1740578785 nameOverride: '' fullnameOverride: '' podAnnotations: {} diff --git a/k8s/workflows/values-prod.yaml b/k8s/workflows/values-prod.yaml index 7342b02a16..1e4af4380b 100644 --- a/k8s/workflows/values-prod.yaml +++ b/k8s/workflows/values-prod.yaml @@ -10,7 +10,7 @@ images: initContainer: eu.gcr.io/airqo-250220/airqo-workflows-xcom redisContainer: eu.gcr.io/airqo-250220/airqo-redis containers: eu.gcr.io/airqo-250220/airqo-workflows - tag: prod-486fc5ca-1740492588 + tag: prod-ce31cd3f-1740578785 nameOverride: '' fullnameOverride: '' podAnnotations: {} diff --git a/k8s/workflows/values-stage.yaml b/k8s/workflows/values-stage.yaml index 0bd3b8e60d..1a49803c3d 100644 --- a/k8s/workflows/values-stage.yaml +++ b/k8s/workflows/values-stage.yaml @@ -10,7 +10,7 @@ images: initContainer: eu.gcr.io/airqo-250220/airqo-stage-workflows-xcom redisContainer: eu.gcr.io/airqo-250220/airqo-stage-redis containers: eu.gcr.io/airqo-250220/airqo-stage-workflows - tag: stage-3aa81a24-1740490113 + tag: stage-58e2cd39-1740493727 nameOverride: '' fullnameOverride: '' podAnnotations: {} diff --git a/src/auth-service/controllers/user.controller.js b/src/auth-service/controllers/user.controller.js index 737ea4b9f2..641d8aa714 100644 --- a/src/auth-service/controllers/user.controller.js +++ b/src/auth-service/controllers/user.controller.js @@ -363,21 +363,23 @@ const createUser = { ? defaultTenant : req.query.tenant; - logObject("req.user.toAuthJSON()", req.user.toAuthJSON()); - const token = req.user.toAuthJSON().token; + const userDetails = await req.user.toAuthJSON(); + logObject("userDetails", userDetails); + const token = userDetails.token; logger.info(`the user token after login with Google is : ${token}`); // Update user fields const currentDate = new Date(); try { - await UserModel(request.query.tenant) // Use the tenant from the request. + await UserModel(request.query.tenant) .findOneAndUpdate( - { _id: req.user._id }, // Access the correct user ID + { _id: req.user._id }, { $set: { lastLogin: currentDate, isActive: true }, $inc: { loginCount: 1 }, - // Add any other updates as needed (e.g., verified) - // ...(req.user.analyticsVersion !== 3 && req.user.verified === false ? { $set: { verified: true } } : {}), // Example (if you have these fields) + ...(req.user.analyticsVersion !== 3 && req.user.verified === false + ? { $set: { verified: true } } + : {}), }, { new: true, upsert: false, runValidators: true } ) @@ -395,8 +397,17 @@ const createUser = { secure: true, // Enable if using HTTPS }); + if (constants.ENVIRONMENT === "STAGING ENVIRONMENT") { + // Create a temporary, non-httpOnly cookie for debugging: + res.cookie("temp_access_token", token, { + httpOnly: false, // Set to false for debugging + secure: true, // But keep secure: true (if using HTTPS) + // maxAge: 60 * 1000, //Expires in 60 seconds. + }); + } + res.redirect( - `${constants.GMAIL_VERIFICATION_SUCCESS_REDIRECT}?success=google` + `${constants.GMAIL_VERIFICATION_SUCCESS_REDIRECT}/xyz/Home?success=google` ); /*** diff --git a/src/auth-service/middleware/passport.js b/src/auth-service/middleware/passport.js index c1e19c122b..1ad11ce99e 100644 --- a/src/auth-service/middleware/passport.js +++ b/src/auth-service/middleware/passport.js @@ -453,8 +453,9 @@ const useGoogleStrategy = (tenant, req, res, next) => } ); cb(null, user); - //return next(); + return next(); } else { + // profilePicture: profile._json.picture, const responseFromRegisterUser = await UserModel(tenant).register( { google_id: profile._json.sub, @@ -462,7 +463,6 @@ const useGoogleStrategy = (tenant, req, res, next) => lastName: profile._json.family_name, email: profile._json.email, userName: profile._json.email, - profilePicture: profile._json.picture, website: profile._json.hd, password: accessCodeGenerator.generate( constants.RANDOM_PASSWORD_CONFIGURATION(constants.TOKEN_LENGTH) @@ -518,7 +518,7 @@ const useGoogleStrategy = (tenant, req, res, next) => } cb(null, user); - // return next(); + return next(); } } } catch (error) { diff --git a/src/auth-service/utils/token.util.js b/src/auth-service/utils/token.util.js index f8cb0de37f..892ab2822d 100644 --- a/src/auth-service/utils/token.util.js +++ b/src/auth-service/utils/token.util.js @@ -81,13 +81,21 @@ let blacklistQueue = async.queue(async (task, callback) => { logObject(`🤩🤩 Published IP ${ip} to the "ip-address" topic.`); // logger.info(`🤩🤩 Published IP ${ip} to the "ip-address" topic.`); callback(); + }) + .catch((error) => { + logObject("kafka producer send error", error); + callback(); }); - await kafkaProducer.disconnect(); + await kafkaProducer.disconnect().catch((error) => { + logObject("kafka producer disconnect error", error); + }); + // callback(); } catch (error) { logObject("error", error); // logger.error( // `🐛🐛 KAFKA Producer Internal Server Error --- IP_ADDRESS: ${ip} --- ${error.message}` // ); + callback(); } }, 1); // Limit the number of concurrent tasks to 1