Basic-Auth icon indicating copy to clipboard operation
Basic-Auth copied to clipboard

Multisite Recursion Problem

Open lucasstark opened this issue 10 years ago • 1 comments

There is a problem with recursion when using multisite. The json_basic_auth_handler calls wp_authenticate, which eventually calls the function is_user_spammy, which calls get_currentuserinfo, which fires off the determine_current_user filter again.

To resolve this i've removed the filter and re-added as such:

remove_filter( 'authenticate', 'wp_authenticate_spam_check', 99 );
$user = wp_authenticate( $username, $password );
add_filter( 'authenticate', 'wp_authenticate_spam_check', 99 );

lucasstark avatar Aug 26 '14 15:08 lucasstark

I reported this separately at WP-API issue #508.

The fix above works perfectly. There should probably be some kind of check to make sure the filter is only removed on multisite, but it gets the job done as a quick hack!

chrisvanpatten avatar Sep 30 '14 11:09 chrisvanpatten