public function handle(Request $request)
{
// Fetch client_id from authenticated token.
$clientId = $this->checkClientId();
// Fetch username and scope from stored code.
list($username, $scope) = $this->checkCode($request, $clientId);
// Check and set redirect_uri.
$redirectUri = $this->checkRedirectUri($request, $clientId);
// Generate access_token, store to backend and set token response.
$parameters = $this->tokenTypeHandlerFactory->getTokenTypeHandler()->createAccessToken($clientId, $username, $scope);
return JsonResponse::create($parameters, 200, ['Cache-Control' => 'no-store', 'Pragma' => 'no-cache']);
}