Type Function Return value Table Revision 2019.3527 Keywords Facebook, access token, token, getCurrentAccessToken See also facebook.isActive facebook.login() facebook.logout() facebook.* fbconnect
This 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
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.v4a" ) local accessToken local function facebookInitListener( event ) print( "Facebook initialized" ) 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 end -- Set the "fbinit" listener to be triggered when initialization is complete facebook.init( facebookInitListener )