Fix API based authentication