Custom auth plugin asks existing users to create a new account after authentication

We recently upgraded our forum to V3. Before doing so, I tested our plugin in a local instance and realized that our auth plugin does not work with V3 so I made the necessary changes to make it work before upgrading the forum on prod. After the upgrade, some users get asked to create a new account after getting authenticated with my company’s SSO. The weird thing is their accounts already exist and they can get back in by resetting their passwords. I am finding it hard to debug the issue because not all users face this problem and I cannot find the root source of the issue. Does anyone have an idea why this is happening?

Do they have different email addresses than they have for their existing accounts?

How does your auth plugin work? If it were discourse connect then there would be no local passwords. Maybe share a link to the plugin.

No, they have the same email.

Here is the link to the plugin: GitHub - purecloudlabs/discourse-purecloud-auth-plugin: A plugin for Discourse forums to authenticate using PureCloud

Please let me know if you have any questions about the code. Thank you!