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:
@@ -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"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user