Type Function Return value Table Revision Release 2024.3703 Keywords Facebook, access token, token, getCurrentAccessToken See also facebook.isActive facebook.login() facebook.logout() facebook.* fbconnect
This function replaces the deprecated facebook.currentAccessToken property. It returns the access token (in the form of a
This will return nil
if nobody is logged in to Facebook.
The table returned from this function is unreliable unless facebook.isActive is true
.
This function returns a table containing the data provided by a Facebook User Access Token:
appId
— String representing the Facebook App ID that you receive when you register your app.
declinedPermissions
— Table containing permissions that the user has denied through the app or through Facebook's app settings.
expiration
— Number that corresponds to the date/time when the Facebook login token expires.
grantedPermissions
— Table containing permissions that the user has granted to the app.
lastRefreshed
— Number that corresponds to the last date/time when the Facebook login token was refreshed.
token
— String representing the access token used by Facebook to represent the current user.
userId
— String representing the ID of the logged in user. This is the same value as the id
field of facebook.request( "me" )
local facebook = require( "plugin.facebook.v4" ) local accessToken if ( facebook.isActive ) then accessToken = facebook.getCurrentAccessToken() if ( accessToken ) then native.showAlert( "Facebook user already logged in", "User's access token: " .. accessToken.token ) else facebook.login() end end