From 4840b0a08868258b52ab5cb36132c74b7c7d8906 Mon Sep 17 00:00:00 2001 From: paul121 Date: Mon, 28 Sep 2020 11:15:32 -0700 Subject: [PATCH] Issue #3172818: Alias oauth2/* endpoints to oauth/*. --- modules/farm/farm_api/farm_api.module | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/farm/farm_api/farm_api.module b/modules/farm/farm_api/farm_api.module index 5075f691e..863837e90 100644 --- a/modules/farm/farm_api/farm_api.module +++ b/modules/farm/farm_api/farm_api.module @@ -50,6 +50,25 @@ function farm_api_menu() { return $items; } +/** + * Implements hook_menu_alter(). + */ +function farm_api_menu_alter(&$items) { + + // Make OAuth2 token endpoints available at both oauth2/* and oauth/*. + // See https://www.drupal.org/project/farm/issues/3172818 + $oauth_aliases = array( + 'oauth2/authorize' => 'oauth/authorize', + 'oauth2/revoke' => 'oauth/revoke', + 'oauth2/token' => 'oauth/token', + ); + foreach ($oauth_aliases as $source => $alias) { + if (!empty($items[$source])) { + $items[$alias] = $items[$source]; + } + } +} + /* * Implements hook_farm_api_oauth2_client() */