Block users from logging in or signing up with Google Login

Problem Statement

We want to enable Google Social Login only for users with a specific domain, such as, and block “” users from signing up or logging in to the application.


You can create an action that validates what is the user’s email domain. If it matches ‘’, you can deny access to that user.

To achieve this behavior, you need to create a Post Login Action.

const onExecutePostLogin = async (event, api) => {
    var userEmailDomain =;
    userEmailDomain = userEmailDomain.split("@")[1];

    if (userEmailDomain == ''){
        return api.access.deny('You are not allowed to access this resource');
exports.onExecutePostLogin = onExecutePostLogin;