hello, I want to ask, can we run supertoken with o...
# support-questions-legacy
m
hello, I want to ask, can we run supertoken with our own ui design, not ui default ?
r
Hey!
Yes you can. Let me send you an example app
m
wow, thanks, i will look this
hello, what happen is it ? something css not load or error
r
hey! are you using emotion?
Also, for custom UI, you do not need to use the supertokens-auth-react SDK. You can use the supertokens-web-js SDK
m
hey, supertokens-web-js need cors in backend ? cuz i getting error cors in my console
r
Hey. Yes. It does. Checkout the quick setup section -> backend setup. It has a section on cors
m
I have installed cors on the backend, but an error appears in the console, isn't /auth/signup automatic?
@rp_st
r
Yea it should be
can you enable backend debug logs and show me the output when you call that API?
m
wait
this
r
yes
does it show any output when u call the API?
m
just like this in the network
r
have you added the supertokens middleware?
to your backend app
m
no
its important ?
r
well.. thats why it's not workijng
please follow the backend quick setup completely
if you don't you will run into issues like this one
m
okey that work thanks you and recipe passwordless must send OTP ? can i just login with phone number only, without otp ?
r
how will you verify the phone number?
you can customise the backend to not require the OTP by overriding the APIs.. but that is very very insecure, as anyone can sign up with anyone's phone number. And also sign in with anyone else's phone number
m
yes, i know its insecure, I'll still use otp later, but not for now.
r
right. Is this for development purposes only? Or actual production flow for users?
m
just for development only
r
ah right. So in that case, you can provide the custom sms sending method and console log the OTP
(assuming that you are using thirdpartypasswordless recipe)
m
ah i see, thanks, i wiil see this
@rp_st iam getting same error with my older thread, but my app must be running on node 18 and if input is wrong , i mean the password length is less than 6, the response is normal, error response but, if the input is valid, iam getting "No SuperTokens core"
this is error response, very normal right
r
What is the connection URI you have passed on the backend SDK? Also, are you running the backend process in docker? About the invalid input, yes, that is a valid response - in this response, you need to show an error to the user stating their password is weak or something
m
my connectionUri is 'http://localhost:3567" iam install on my local my app just running backend and frontend at the same time
r
what happens when you visit http://localhost:3567/hello on your browser?
m
its Hello
r
and your not using docker for the backend?
m
no
r
hmm.. weird
m
last time, i am using node 16, is run normally, but this time my app need run on node 18
r
im not sure why your node backend can't connect to the core
might be some issue with networking module in node 18? Maybe some firewall setting on your machine
You can try and google "node 18 can't connect to localhost"
m
okey
@rp_st hello rp, that error is gone, cuz iam using core with docker.. i have question, how to get code OTP from front end with that function or how to automatic login with just insert phone number ?
r
you should not get the otp on the frontend
instead, override the sendSms function on the backend and console log the otp
i had sent a link above that shows you how to do that
m
yes, im override the sendSms and console log the otp but how to automatic login ?
iam just get the local storage, data
r
well, for that, you will need to do a few customisations since the default flow doesn't allow that. You can override the createCode API and send a custom response to the frontend (See https://supertokens.com/docs/thirdpartypasswordless/advanced-customizations/apis-override/custom-response/api-override) Then on the frontend, when you call createCode, the response should have the raw reponse object which will contain your custom body from which you can get the OTP.
another way is to just allow using any OTP for example 0000
where the frontend can just send 0000 and you override the backend consumeCode to fetch the actual OTP based on the preAuthSessionId field. You would of course need to store that mapping somewhere on your backend, but you can do that in the sendSms function.
m
yeah, i get it, thanks a lot @rp_st
Sorry for bothering you.
😁
r
nice!