How do I check login?
The correct approach for this would be to implement a service, in which you put the contents of the fb.php and there all the Drupal functions will be recognized.
Here is an example of a service implementation: https://docs.acquia.com/articles/drupal-8-services-dependency-injection-and-service-containers