Linking SAML account and want to require user to enter password before linking

Hi @jeremybong, and thank you for the question!

I believe your flow using a post-login action is correct, and all you need is to add a check that exits the flow if the users have already been linked to prevent the loop you are experiencing.

You can try to do that using the event.user.identities array like this:

const primaryIdentity = event.user.identities[0];
const secondaryIdentity = event.user.identities[1];

if (!secondaryIdentity) {
    return;
}

I hope this helps you!

Sincerely,
Teodor.