Hello,
We are trying to access our Google Workspace groups’ IDs but I don’t seem to be able to find a way to access this information through Terraform.
When we log event.user.groups
, as a result we only get the groups’ names. We need to retrieve the IDs of these groups, but this information is not available through the event.user.groups
.
The docs indicate that this ID information is available through the googleworkspace_group.id
. We do not manage to reach this property though.
Here is what our currently custom Action looks like:
exports.onExecutePostLogin = async (event, api) => {
if (event.client.client_id === event.secrets.referentialFrontClientId && event.connection.name === "connection-google-apps" && event.user.groups) {
const ManagementClient = require('auth0').ManagementClient;
const distinct = (value, index, self) => {
return self.indexOf(value) === index;
}
const management = new ManagementClient({
domain: event.secrets.domain,
clientId: event.secrets.clientId,
clientSecret: event.secrets.clientSecret,
});
const referentialRoles = JSON.parse(event.secrets.referentialRoles);
const emailsRolesMap = JSON.parse(event.secrets.emailsRolesMap);
const currentUserRolesName = event.authorization.roles;
const currentUserGroups = event.user.groups;
const rolesMap = JSON.parse(event.secrets.rolesMap)
// we would like to log here the googleworkspace_group.id
console.log("Google Workspace groups IDs : " + ???);
// ... rest of the code