Before using any of the Facebook functions you must call this function to initialize the Facebook API and tell GameMaker Studio 2 that you are going to be using the Facebook specific functions. This should be done only once in the game and can be done at any time, but it is recommended that you call this function right at the start before anything else. Note too, that even if you use facebook_logout at some point in your game you will not need to use this function again to log in.
var permissions = ds_list_create();
The above code initialises Facebook, then creates a ds_list to hold the specific permissions that you wish to request, and finally logs in using these permissions.