facebook.getCurrentAccessToken()

Type Function
Return value Table
Revision 2017.3060
Keywords facebook, accessToken, token
See also facebook.isActive
facebook.login()
facebook.logout()
facebook.*
fbconnect

Overview

This function replaces the deprecated facebook.currentAccessToken property. It returns the access token (in the form of a table of data) used by Facebook to represent the current user.

Gotchas

Syntax

facebook.getCurrentAccessToken()

Return Value

This function returns a table containing the data provided by a Facebook User Access Token:

Example

local facebook = require( "plugin.facebook.v4" )
local accessToken

facebook.setFBConnectListener( facebookListener )

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

Facebook Resources