• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Duplicate External auth problem with several providers


Well-known member
The current external auth system allows user to have only one provider.
Since the primary key in xf_user_external_auth is user_id.
External authes work good separately but when you try to associate existing account to new provider the new provider will replace the old provider:
    public function updateExternalAuthAssociation($provider, $providerKey, $userId, $userProfileField = null, array $extra = null)
            INSERT INTO xf_user_external_auth
                (provider, provider_key, user_id, extra_data)
                (?, ?, ?, ?)
                provider = VALUES(provider),
                provider_key = VALUES(provider_key),
                user_id = VALUES(user_id),
                extra_data = VALUES(extra_data)
        ', array($provider, $providerKey, $userId, serialize($extra)));
I suggest to allow multiple provider auth, i.e. just to set primary as user_id-provider instead of user_id and change the method above.

It will be useful for future functionality. For example, user will be able to tweet threads using twitter and upload pictures from facebook.