Issue #3172818: Alias oauth2/* endpoints to oauth/*.

This commit is contained in:
paul121 2020-09-28 11:15:32 -07:00 committed by Michael Stenta
parent 39ff4d1529
commit 4840b0a088
1 changed files with 19 additions and 0 deletions

View File

@ -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()
*/