Cyber security is important of power grids to ensure secure and reliable power supply. This paper presented a cyber- secure framework for power grids based on federated learning. In this framework, each entity, which may be a distribution/transmission/generation service provider or even a customer, can contribute to the overall system immunity and robustness to cyber-attacks, while not required to share local data, which may have privacy, legal and property concerns. The main idea is to use the federated learning framework to share the knowledge learned from local data instead of sharing power grid data itself. With complete knowledge learned from all data from the power grid, each entity is better positioned to defend the cyber-attacks and improve power grid resiliency. Future work on applying this federated learning based framework in power systems is also discussed.