Hello everyone, I'm new to SuperToken. I'm exploring whether that super token is a suitable solution...
j
Hello everyone, I'm new to SuperToken. I'm exploring whether that super token is a suitable solution for auth in our project. We are creating lot of white label applications under one login/signup process. every white label application has its own react native mobile application and nextjs web application. we also provide custom domain masking as well. We want login flow like : [username or email or mobile & password] or google/facebook Required signup flow: [email or mobile + otp] or google/facebook A problem is on the web we want to create sso.example.com for sharing one login/signup flow. is there any way I can share my session while redirecting to another domain(many cases not a subdomain) Thanks for even reading all these 😅 .
r
hey @jaykaneriya not at the moment. Sorry. We are not yet an oauth provider. However, you can hack a solution to get it to work
j
Thanks @rp_st, I'm not looking for oAuth provider because in our invitation flow we don't want users to sign up and verify their email or mobile again. (I'm thinking about magic link) This hack will work in my case. can you share some light on how I can implement login and sign flow as I want. Currently I'm testing it with contactMethod: "EMAIL_OR_PHONE", flowType: "USER_INPUT_CODE_AND_MAGIC_LINK", What should be my approach for the below requirements > login flow like : [username or email or mobile & password] or google/facebook > signup flow: [email or mobile + otp] or google/facebook If you can guide me then It will be a great help.
r
j
@rp_st In this recipe, I have to signup with email or mobile + password. Can I change the flow like at the first step verify email or mobile with otp and then I can set the password afterward? and how can I login with username? at this step, i'm a bit confused. My question is how can I customize the flow of the recipe?
r
You can build this. But it will require customisations
You should pick the passwordless recipe first
Email / sms OTP
And then, after that’s completed, as users to enter a password using custom UI
And then create an email password user from that and link that account to the passwordless one (using our account linking feature)
j
Thanks @rp_st, I will try this solution.
Hey @rp_st ,sorry to interrupt you again. But I am confused that can I able to create user from backend using my own API. like using api key or something like that. Let me share you my use case. When a user invites another user then we send an email or sms to them. When they clicked on the email I need to create that user with verified true. this is one case but I'm sure I need some kind of control to create/update/delete user in my backend environment. I checked the docs but didn't find something like this. Can we have support for this?
r
there are functions we have for that from our sdk
see the functions here: supertokens.com/docs/nodejs
j
Okay, Thanks a lot @rp_st
Hey @rp_st, We have an email and phone no for the user and we are only maintaining is email verified state? What if I sign up with email + OTP? later I added a phone no as well (not verified yet). When I logged in with my phone no in that case it create a new account or logged in to an existing one? I have this kind of requirement users can able to log in with email or phone no. if he/she added to their profile. Can you guide me how can I handle this case?
r
> When I logged in with my phone no in that case it create a new account or logged in to an existing one? It will log in to the existing account that already has that phone number.
j
Without verification? or do I have to manually manage is phone verified state?
r
as in, logging into an account with phone otp implies that it's verified
j
Okay @rp_st , But my main concern is while I give a user option to add a mobile no after they join using email. in that case, if the user enters the wrong number or someone else number. Then other users might not be able to add their number.
r
That’s true. You can use our MFA recipe to make the user go through mobile OTP flow. And that will automatically verify + add the mobile number to their account as a longin method
See our MFA docs.
Or actually. Not even that’s required
Just enable automatic account linking feature. And then when the user enters their mobile number, call the create code api with it which will send them an OTP on it. And show a ui for them to enter an OTP which calls the consumeCode api. If they enter the right OTP the consumeCode api will link that user to the existing session user and you are done.
j
Okay @rp_st, Thanks for sharing details
Hey @rp_st, I'm just one step away from choosing super token as an auth provider. Can I able to create and assign a session based using userId? My requirement: I have a table in db for managing invitations and who sent it and status of it with hash. When invited user clicked on the link given in email or mobile then based on hash I will create that user using node-sdk function. I also need to logged in to that user (somehow need to create a session just like we got affter submitting otp in passwordless) and redirect to profile completion page. for creating user backend side do we have a function like this thirdPartyManuallyCreateOrUpdateUser that creates a verified passwordless user & I also need to find a function to create and send a session with it. Can I do that or I need to re-invent the wheel by coding all by myself ☹️ ?
j
Thanks man really appreciate your help @rp_st
There isn't a problem using session customizations with thirdparypasswordless recipe right?
r
no probloem
j
Thanks
Last question, I guess then I'm good to go with integration with my application. Which function allows me in thirdpartypasswordless to create a user without sending verification mail or SMS and allows me to set either email or phone with verification status true. thirdPartyManuallyCreateOrUpdateUser is only for social login I guess. and passwordlessSignInUp will send verification mail because it doesn't have a isVerified property.
and to add a phone number to an existing user, you use updatePasswordlessUser
j
Thanks 👍
3 Views