public override Task TokenEndpointResponse(OAuthTokenEndpointResponseContext context) { var accessToken = context.AccessToken; var identidade = context.Identity; string connectionstring = WebConfigManipulation.GetConfig("ConnectionString"); ConnectionEnum connectionType = (ConnectionEnum)Convert.ToInt32(WebConfigManipulation.GetConfig("ConnectionType")); var connectionFactory = new ConnectionFactory(connectionstring, connectionType); int id = Convert.ToInt32(identidade.Claims.Single(x => x.Type == "Id").Value); int empresaId = Convert.ToInt32(identidade.Claims.Single(x => x.Type == "EmpresaId").Value); var userBO = new UsuarioBO(connectionFactory, id, empresaId); userBO.AtualizarToken(id, accessToken); return(Task.FromResult <object>(null)); }