How to make user disconnect at RegisterBeforeAuthenticateXXXX

Hello everyone, I have a problem, If i want to kick user at “RegisterBeforeAuthenticateEmail” this checkpoint, How to make user disconnect?

I assume by “kick” you are actually referring to disallowing the user to authenticate with the system.

According to the documentation from this page:

If you choose to return nil instead of the payload (or a non-nil error in Go) the server will halt further processing of that message. This can be a used to stop the server from accepting certain messages or disabling/blacklisting certain server features.

This is quite simple and can be done with a few lines of Lua/Go:

local nk = require("nakama")

local M = {}

function M.authenticate_email(context, payload)
  local email =
  -- local password = payload.account.password

  -- perform custom logic here
  if (email == "") then
    return nil

  -- make sure that you return payload
  return payload
nk.register_req_before(M.authenticate_email, "AuthenticateEmail")

return M

thanks your answer.