Is there a way to auto set primary user on sign-up...
# support-questions-legacy
i
Is there a way to auto set primary user on sign-up? Otherwise I override signInUp on backend and call createPrimaryUser
r
hey @ilbarbarossa this should happen on its own if you enable automatic account linking.
i
Even if i Need to link another social account (custom provider telegram) only after sign-in/sign-up?
r
are you linking based on email?
or is it more like connect telegram account to an already logged in user?
i
This. Basically is only social login and then give the option to connect a telegram account
r
right
so in this case, you would have to manually do the linking when they login with telegram
we have an example app that kind of show cases this.
So first, you want to override the signinup API to make the current user a primary one, if it's a sign up. Then for connecting telegram accounts, you can implement an API like this: https://github.com/supertokens/supertokens-auth-react/tree/master/examples/with-account-linking where this APi is called on the callback screen of telegram, and in this, you manually do the code excahnge, and then link the account with the session's account.
you can take inspiration from this method and tweak it to match your exact use case.
i
exactly! so for this use case (connect post login) the right way is overriding signInUp function on the backend. Thank you very much
Sorry again, but it seems that Account Linking feature is not enable for my app (I am using dev env of managed service) and function createPrimaryUser threw error. Do I have to send an email about it?
r
Hey
You can generate the license key via the button on the dashboard
And that will send you an email with the license key. Which you can add to your Dev instance
i
It's not only for self hosted?
r
Yea it’s not.
We are in the process of fixing this flow. But for now, this is how it is
i
Thank you again! Much appreciated
7 Views