Sign up control

Hey guys. Is there a way to disable sign up from the public (authClient) but still have it enabled for the server code (auth.api)? I don’t want anyone to be able to sign up. I want admins to create users. I’m imagining that a smart person who knows how the auth clients calls the API would be able to create users if it is enabled .
Solution
you can use hooks then

hooks: {
  before: async(c)=>{
    if(c.path === "/sign-up/email" && c.request){
      throw c.error("UNAUTHROIZED")
    }
  }
}
Was this page helpful?