Whitelist signup/login emails + social

Hello, I’m trying to use actions in the dashboard, as suggested in the docs.

My use case is this:
I’m building a small demo that will be hosted in production, but I want only certain people to be able to log in at first.
I implemented social and user+password with Auth0 login in my Next.js app.
I created a little whitelist in the pre-register flow as well as post login flow (why there is no pre login?), but I noticed that if I try to register/log in with a social account - nothing stops it. So basically, the functionality I added in the actions is working only in 1 flow when a user is trying to sign up regularly (not social)
Is there any way to block a social login, if the email is not in my whitelist?

I must say, to me the docs about actions are not thorough enough, and I think my use case is pretty common - allow limited access login to early stage products.

I haven’t been able to verify this because I got distracted by something else but would something like this help?

/**
* Handler that will be called during the execution of a PostLogin flow.
*
*
* @param {Event} event - Details about the user and the context in which they are logging in.
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
*/
exports.onExecutePostLogin = async (event, api) => {
  if (event.user.email && ! event.user.email.endsWith("@*********.com") && event.client.name === "*********") {
    api.access.deny(`Access to ${event.client.name} is not allowed.`);
  }
};

Thanks, but that’s exactly why I did. I managed to get “access_denied”, but now I have 2 issues:

  1. How can I catch this 400 error on my side and do something like redirect to the login page again and let the user try to login with another account? It would be nice if I could display the error somehow as I display it for email+password register.

  2. when I try to manually go to login again, it looks like it “remembers” the access denied and doesn’t let me try login again normally…I guess there is some kind of cache issue? But not sure what to do

Sorry, this is also as far as I have been able to get on this issue, right now.