feat(auth): add logging for token audience validation in Google authentication

- Introduced console logs in the `googleMobileAuth` method to display the token audience, allowed client IDs, and the status of relevant environment variables.
- This enhancement aids in debugging and ensures better visibility into the authentication process.
This commit is contained in:
Chamika J
2025-08-04 17:02:48 +05:30
parent 01ce34f3d8
commit f84d834295

View File

@@ -201,6 +201,13 @@ export default class AuthController extends WorklenzControllerBase {
process.env.GOOGLE_IOS_CLIENT_ID, // iOS client ID
].filter(Boolean); // Remove undefined values
console.log("Token audience (aud):", profile.aud);
console.log("Allowed client IDs:", allowedClientIds);
console.log("Environment variables check:");
console.log("- GOOGLE_CLIENT_ID:", process.env.GOOGLE_CLIENT_ID ? "Set" : "Not set");
console.log("- GOOGLE_ANDROID_CLIENT_ID:", process.env.GOOGLE_ANDROID_CLIENT_ID ? "Set" : "Not set");
console.log("- GOOGLE_IOS_CLIENT_ID:", process.env.GOOGLE_IOS_CLIENT_ID ? "Set" : "Not set");
if (!allowedClientIds.includes(profile.aud)) {
return res.status(400).send(new ServerResponse(false, null, "Invalid token audience"));
}