Hi, I have a question. I am creating a login for a...
# support-questions
k
Hi, I have a question. I am creating a login for a company dashboard. Right now anybody can sign up and sign in, but I want that the user account has to be approved (just one time) before to log in. Is there a way to do it. I am using email and password authentication
r
So will you be creating the user's account + adding some password for them manually before? Or just allowing whitelisted emails to sign up?
k
just allowing whitelisted emails to sign up
r
you can do that by overriding the sign up API and before calling the original implementation, check if the input email is whitelisted or not
checkout advanced customisation > API override section
k
Thank you
That was the solution
g
@KalibCheil Did you override the frontend or backend to implement this? If you have a snippet to share I would appreciate it
r
@gidgiddoni you need to override then backend’s signUp function.
g
@KalibCheil Thanks for responding! I have this on my backend config but it doesn't seem to be doing anything. Is there something I am missing? https://gist.github.com/GideonStowell/0fd02235264bf64edc0af502c111d58b
r
Can you add a console log in that function and see if it gets printed?
g
I did and it doesn't get printed. I thought maybe it was because I was overriding the
thirdPartySignUpIn
function but I am testing using a email and password to login. So I tried overriding the
emailpasswordSignIn
function but I a,m getting the same result. It won't print anything to the logs
r
Are you calling the sign up or sign in api?
There is also emailpasswordSignUp. You want to add this logic in there instead of emailpasswordSignIn
g
I just updated the gist to show what I am trying rn. I think I am using the emailPasswordSignUp/In api correctly
r
Hmm. You should check the types from the lib to confirm you are doing it correctly
And you can even enable the backend debug logs and see the output of that when calling the api to see what’s happening
g
How do I enable those logs?
r
Troubleshooting section in docs
g
Okay cool. Turning on those logs I can now see the
input
getting logged. Also I have a type error so this gives me somewhere to troubleshoot.. thanks!!
r
👍
g
In case anyone else finds this thread this example in the docs shows another way of doing this by overriding the POST apis. https://supertokens.com/docs/thirdpartyemailpassword/advanced-customizations/apis-override/custom-response/general-error
10 Views