if ( !
empty( $_REQUEST['reject_url'
] ) ) { $reject_url =
$_REQUEST['reject_url'
];
} elseif ( $success_url ) { $reject_url =
add_query_arg( 'success', 'false',
$success_url );
} else { $reject_url = null;
}$user =
wp_get_current_user();
$request =
compact( 'app_name', 'app_id', 'success_url', 'reject_url'
);
$is_valid =
wp_is_authorize_application_password_request_valid( $request,
$user );
if ( is_wp_error( $is_valid ) ) { wp_die( __( 'The Authorize Application request is not allowed.'
) . ' ' .
implode( ' ',
$is_valid->
get_error_messages() ),
__( 'Cannot Authorize Application'
) );
}if ( wp_is_site_protected_by_basic_auth( 'front'
) ) { wp_die( __( 'Your website appears to use Basic Authentication, which is not currently compatible with application passwords.'
),