WP-API custom auth

  1. function checkApiAuth( $result ){
  2. // if user and token from app match user meta in wp, continue
  3. $app_token = $_GET['app_token'];
  4. $user_id = $check_user_id;
  5. $wp_token = get_user_meta( $user_id, 'app_token', true);
  6.  
  7. if( empty( $app_token ) )
  8. $result = false;
  9. if( $wp_token === $app_token )
  10. $result = true;
  11.  
  12. return $result;
  13. }
  14. add_filter('json_authentication_errors', 'checkApiAuth');
Scott Bolinger