Adding a role in an identity webhook

I’m trying to add a role to users who sign up with Google in Netlify Identity.
I’ve used this Netlify repo (GitHub - netlify/netlify-plugin-identity-sso: UNOFFICIAL - allows easily adding SSO access control to a Netlify site) as a starting point, and the code looks like this:

if (email && email.endsWith('@example.com')) {
  console.log(`Adding admin role to ${email}`);
  return {
    statusCode: 200,
    body: JSON.stringify({
      app_metadata: {
        ...appMetadata,
        roles: ['admin']
      }
    })
  };
}

I’m triggering this from all the identity webhooks, and the logs look this:

Jan 25, 06:16:36 PM: b7641cc2 INFO Adding admin role to sam@example.com

But the role is never added. Has the method to add roles like this changed?

Hi,

We’ve responded to this in the helpdesk. Let us know if it works.