Hey team, we need help with enabling automatic acc...
# ory-network
m
Hey team, we need help with enabling automatic account linking. The docs explain how it works but don't explain how to enable it. Currently we are seeing the errors but we are not able to link the accounts automatically without going to settings, could you point us to the correct place to enable this
b
Not sure, I understand the problem. What have you tried and what are you trying to achieve?
m
The problem is, user having a google account and trying to log in with password, or having a password and trying to log in with google account (same email address). We want the users to be able to link those accounts automatically and be able to use either of those login methods to get in. Currently when they try to do that, they get an errors message with message id
4000028
"You tried signing in with {credential_identifier_hint} which is already in use by another account."
How do we enable them to be able to automatically link the accounts without the need to link them manually @bland-eye-99092
b
Automatic, as in no user interaction, is not possible. However, you can enable login hints on https://console.ory.sh/projects/current/authentication, which will improve the screen's UX a lot.
m
We don't need no user interaction but: if they already have google account, it prompts them to log in with google to link them if they already have a password, prompts them to enter the password to link them without the need to do it manually in settings
b
yes, if you enable login hints it will do exactly that.
m
we do have that, but the linking never happens
b
So the account at e.g. Apple is not added to the identity if the user confirms the linking with Google?
m
error message
4000028
is returned
b
yea, that's expected, because the user still needs to confirm the "linking" by signing in with Google, their password, or whatever credential they used before.
m
yea so once we get that error message, we tell the user to go back and sign in with the original provider, then the user does that and is able to log in
but accounts are not linked
b
You don't need to go back, you can just use the buttons of that flow, and then it will be linked.
m
is there a link flow we could call the same way we can create and call registration/login flows? would spare us a lot of issues
b
That happens automatically. The flow with the
4000028
error is a link flow.
If you use the nodes of that flow/update that flow with the user's input the additional provider will be added.
m
can we call it directly? we have a request that is finding out if the user account is registered and what method they used which is faster than depending on the registration request to fail in order to get the link flow
we would want to handle that logic ourselves and just choose which flow to call, like we do right now with registration/login
b
No, you'll need to fail the flow in order to do the linking. Or you can use the settings flow behind the scenes. But that's not really how it's intended to work.