/** * @param \OAuth2\Grant\GrantTypeResponseInterface $grant_type_response * * @throws \OAuth2\Exception\BadRequestExceptionInterface */ private function checkRequestedScope(GrantTypeResponseInterface $grant_type_response) { //Check if scope requested are within the available scope if (!$this->getScopeManager()->areRequestScopesAvailable($grant_type_response->getRequestedScope(), $grant_type_response->getAvailableScope())) { throw $this->getExceptionManager()->getBadRequestException(ExceptionManagerInterface::ERROR_INVALID_SCOPE, sprintf('An unsupported scope was requested. Available scopes are [%s]', implode(',', $grant_type_response->getAvailableScope()))); } }