How to allow user to edit post in wordpress

It would seem like the Basic Authentication Plugin is modifying the contributor user role, removing their edit_posts capability. As you need this plugin activated, I see a couple of options

Make a new user role with edit-post capabilities

Create a new role that has only the capabilities you need it to have. That way you avoid messing with the permissions of an existing role. Add this piece of code to your plugin main file (changing function names, capabilities and role data as you seem fit).

function add_new_special_rol(){
    $role = add_role( 'special_role_slug', 'Special Role Name', array(//Capabilities array
       'edit_posts'     => true, // True allows that capability
       'switch_themes'  => false, // False restricts that capability
    ));
}

function remove_special_rol(){
    $role = remove_role('special_role_slug');
}

register_activation_hook( __FILE__, 'add_new_special_rol' );
register_deactivation_hook( __FILE__, 'remove_special_rol' );

Keep in mind that the add_role and remove_role functions modify the database, so they should be used only when deactivating or activating a plugin/theme, thats why we hook the functions with register_activation_hook and register_deactivation_hook.

You can see all capabilities available here
https://wordpress.org/support/article/roles-and-capabilities/#switch_themes

Edit the Contributor role capabilites

You can override whatever value the edit_posts capability has for the contributor role.

function modify_contributor_role_capabilities($wp_roles){
    //We get the contributor role object
    $contributor_role = $wp_roles->get_role('contributor');
    if($contributor_role)
        //then we make them be able to edit posts modifying their capabilities array
        $contributor_role->capabilities['edit_posts'] = true;
};
//Hook the function to the 'wp_roles_init' hook, that gives us access to the WP_Roles instance
//high priority just in case
add_action( 'wp_roles_init', 'modify_contributor_role_capabilities', 999 );

In this case we are be modifying the contributor role directly, no database modifications. This is posible through the wp_roles_init action hook, which can only be used in a plugin.