facebook_login(permissions, ios_login_type)
Argument | Description |
---|---|
permissions | The permissions you want to have from the user logging in. |
ios_login_type | The iOS only log in type (see the list of constants below). |
Returns: N/A
With this function GameMaker: Studio will connect to
Facebook and ask the user to log into their account. You may also
supply additional permission requests in the form of a ds_list that
this function then converts into a json array to
communicate them to Facebook. There are a wide variety of
permissions you may request and they are documented on the Facebook
developers pages found here. If you do not wish to ask for any special or
extended permissions then you will still need to send a ds_list,
but this time it will be empty.
This function is also considered as being asynchronous as
while the Facebook login window is open on the screen, the game
will continue to run in the background and even once the user has
completed the login process, none of the other Facebook functions
will work until the facebook_status() returns
"AUTHORISED" . Due to the need for an internet connection and the
different rates of data transfer, this means that it could be
several seconds before this authorisation is received, and all the
while the game will still be running.
NOTE: You can now only in read permissions to this function. If you require write permissions, you need to call facebook_request_publish_permissions() after logging in. Also note that if your game requests for more than than the public_profile, email and user_friends it will require review by Facebook before it can be used by people other than the game's developers.
There is an extra parameter required for iOS login (other platforms can simply use fb_login_default for the argument). This should be one of the constants listed below:
Constant | Description |
---|---|
fb_login_default | Use the default iOS login behaviour (see here for further details). |
fb_login_fallback_to_webview | Attempt Facebook login, asking user for credentials if necessary. |
fb_login_no_fallback_to_webview | Attempt Facebook login, but no direct request for credentials will be made. |
fb_login_forcing_webview | Only attempt WebView login, asking user for credentials |
fb_login_use_system_account | Attempt Facebook login, preferring the system account and falling back to a fast app switch if necessary. |
fb_login_forcing_safari | Attempt only to login with Safari. |
The above listed constants change the login behaviour on iOS,
permitting you to select which fallback methods to use (if any)
should login fail from through the normal process. For further
information please see this
Facebook Developer page.
facebook_init();
var permissions = ds_list_create();
ds_list_add(permissions,"public_profile", "user_friends");
facebook_login(permissions, fb_login_default);
ds_list_destroy(permissions);
The above code will initialize Facebook and then log the current user in, asking for the extended read permissions given.