public function token(Request $request)
    {
        $bridgeResponse = new BridgeResponse;
        $oauthRequest   = OAuthRequest::createFromRequest($request);
        $response       = $this->server->handleTokenRequest($oauthRequest, $bridgeResponse);

        if ($response->isOk()) {
            $user = $this->userService->findById($response->getParameter('user_id'));

            if (! $user) {
                return $this->createInvalidCredentialResponse();
            }

            if (! $user->getEnabled()) {
                return $this->createInvalidCredentialResponse();
            }

            // If enabled in config, check that user is verified
            if ($this->requireVerification && ! $user->getVerified()) {
                return $this->createSimpleResponse(422, 'Unverified user');
            }

            $userId = $response->getParameter('user_id');

            $this->setLastLogin($userId);

            $this->session->set('user', $userId);
        }

        return $response;
    }