1. 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

Discussion in 'Resolved Bug Reports' started by guiltar, Jan 14, 2012.

  1. guiltar

    guiltar 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:
    PHP:
        public function updateExternalAuthAssociation($provider$providerKey$userId$userProfileField null, array $extra null)
        {
    ....
            
    $db->query('
                INSERT INTO xf_user_external_auth
                    (provider, provider_key, user_id, extra_data)
                VALUES
                    (?, ?, ?, ?)
                ON DUPLICATE KEY UPDATE
                    provider = VALUES(provider),
                    provider_key = VALUES(provider_key),
                    user_id = VALUES(user_id),
                    extra_data = VALUES(extra_data)
            '
    , array($provider$providerKey$userIdserialize($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.
     
  2. Mike

    Mike XenForo Developer Staff Member

Share This Page