diff --git a/core/modules/rest/src/Entity/ConfigDependencies.php b/core/modules/rest/src/Entity/ConfigDependencies.php
index 3b39ccf1c58a2269543587964963b25718908e1b..4b03057e570f9b869a502483f05c5bd9c1e3a71a 100644
--- a/core/modules/rest/src/Entity/ConfigDependencies.php
+++ b/core/modules/rest/src/Entity/ConfigDependencies.php
@@ -8,6 +8,8 @@
 
 /**
  * Calculates rest resource config dependencies.
+ *
+ * @internal
  */
 class ConfigDependencies implements ContainerInjectionInterface {
 
@@ -51,13 +53,20 @@ public static function create(ContainerInterface $container) {
   /**
    * Calculates dependencies of a specific rest resource configuration.
    *
+   * This function returns dependencies in a non-sorted, non-unique manner. It
+   * is therefore the caller's responsibility to sort and remove duplicates
+   * from the result prior to saving it with the configuration or otherwise
+   * using it in a way that requires that. For example,
+   * \Drupal\rest\Entity\RestResourceConfig::calculateDependencies() does this
+   * via its \Drupal\Core\Entity\DependencyTrait::addDependency() method.
+   *
    * @param \Drupal\rest\RestResourceConfigInterface $rest_config
    *   The rest configuration.
    *
    * @return string[][]
    *   Dependencies keyed by dependency type.
    *
-   * @see \Drupal\Core\Config\Entity\ConfigEntityInterface::calculateDependencies()
+   * @see \Drupal\rest\Entity\RestResourceConfig::calculateDependencies()
    */
   public function calculateDependencies(RestResourceConfigInterface $rest_config) {
     $granularity = $rest_config->get('granularity');
@@ -96,10 +105,6 @@ public function calculateDependencies(RestResourceConfigInterface $rest_config)
       }
     }
 
-    if (isset($dependencies['module'])) {
-      sort($dependencies['module']);
-    }
-
     return $dependencies;
   }
 
@@ -156,12 +161,12 @@ protected function onDependencyRemovalForMethodGranularity(RestResourceConfigInt
         // authentication providers and formats.
         foreach (array_keys($rest_config->get('configuration')) as $request_method) {
           foreach ($removed_formats as $format) {
-            if (in_array($format, $rest_config->getFormats($request_method))) {
+            if (in_array($format, $rest_config->getFormats($request_method), TRUE)) {
               $configuration[$request_method]['supported_formats'] = array_diff($configuration[$request_method]['supported_formats'], $removed_formats);
             }
           }
           foreach ($removed_auth as $auth) {
-            if (in_array($auth, $rest_config->getAuthenticationProviders($request_method))) {
+            if (in_array($auth, $rest_config->getAuthenticationProviders($request_method), TRUE)) {
               $configuration[$request_method]['supported_auth'] = array_diff($configuration[$request_method]['supported_auth'], $removed_auth);
             }
           }
@@ -207,7 +212,7 @@ protected function onDependencyRemovalForMethodGranularity(RestResourceConfigInt
    * @return bool
    *   TRUE if the entity has been changed as a result, FALSE if not.
    */
-  public function onDependencyRemovalForResourceGranularity(RestResourceConfigInterface $rest_config, array $dependencies) {
+  protected function onDependencyRemovalForResourceGranularity(RestResourceConfigInterface $rest_config, array $dependencies) {
     $changed = FALSE;
     // Only module-related dependencies can be fixed. All other types of
     // dependencies cannot, because they were not generated based on supported
@@ -218,15 +223,19 @@ public function onDependencyRemovalForResourceGranularity(RestResourceConfigInte
       $removed_formats = array_keys(array_intersect($this->formatProviders, $dependencies['module']));
       $configuration_before = $configuration = $rest_config->get('configuration');
       if (!empty($removed_auth) || !empty($removed_formats)) {
+        // All methods support the same formats and authentication providers, so
+        // get those for whichever the first listed method is.
+        $first_method = $rest_config->getMethods()[0];
+
         // Try to fix dependency problems by removing affected
         // authentication providers and formats.
         foreach ($removed_formats as $format) {
-          if (in_array($format, $rest_config->getFormats('GET'))) {
+          if (in_array($format, $rest_config->getFormats($first_method), TRUE)) {
             $configuration['formats'] = array_diff($configuration['formats'], $removed_formats);
           }
         }
         foreach ($removed_auth as $auth) {
-          if (in_array($auth, $rest_config->getAuthenticationProviders('GET'))) {
+          if (in_array($auth, $rest_config->getAuthenticationProviders($first_method), TRUE)) {
             $configuration['authentication'] = array_diff($configuration['authentication'], $removed_auth);
           }
         }
diff --git a/core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php b/core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php
index 86e80f2df7ad67463a6f79ce6703806f41e13517..f62ee03f26f67d7da5a7407c5c986b77ad80f400 100644
--- a/core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php
+++ b/core/modules/rest/tests/src/Kernel/Entity/ConfigDependenciesTest.php
@@ -31,7 +31,7 @@ public function testCalculateDependencies(array $configuration) {
 
     $result = $config_dependencies->calculateDependencies($rest_config);
     $this->assertEquals(['module' => [
-      'basic_auth', 'hal', 'serialization',
+      'basic_auth', 'serialization', 'hal',
     ]], $result);
   }
 
@@ -64,11 +64,11 @@ public function providerBasicDependencies() {
           'granularity' => RestResourceConfigInterface::METHOD_GRANULARITY,
           'configuration' => [
             'GET' => [
-              'supported_auth' => ['cookie'],
+              'supported_auth' => ['basic_auth'],
               'supported_formats' => ['json'],
             ],
             'POST' => [
-              'supported_auth' => ['basic_auth'],
+              'supported_auth' => ['cookie'],
               'supported_formats' => ['hal_json'],
             ],
           ],